Shell Script: Unterschied zwischen den Versionen

Aus MeinWiki
Wechseln zu: Navigation, Suche
K
K (Funktion)
Zeile 1: Zeile 1:
 
== Funktion ==
 
== Funktion ==
 
*get script path
 
*get script path
     #get script path
+
     # get script path
 
     GetScriptPath()
 
     GetScriptPath()
 
     {
 
     {
 
         echo "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
         echo "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 +
    }
 +
*write logfile
 +
    # write logfile
 +
    # $1 Description
 +
    # $2 Logfiledestination
 +
    WriteLog ()
 +
    {
 +
        echo $(date "+%y%m%d-%H%M%S")' '$1 >> $2
 
     }
 
     }

Version vom 25. August 2014, 06:48 Uhr

Funktion

  • get script path
   # get script path
   GetScriptPath()
   {
       echo "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
   }
  • write logfile
   # write logfile
   # $1 Description
   # $2 Logfiledestination
   WriteLog ()
   {
       echo $(date "+%y%m%d-%H%M%S")' '$1 >> $2
   }