Difference between revisions of "Scripting"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 10: Line 10:
  
 
= TroubleShooting =
 
= TroubleShooting =
Use xtrace to get every line of a script shown before the line is executed.
 
 
 
If you want every line to be shown with evaluated values, write the following to the beginning of the script:
 
If you want every line to be shown with evaluated values, write the following to the beginning of the script:
 
  set -x
 
  set -x
 
or -xv for verbose
 
or -xv for verbose

Revision as of 08:16, 21 December 2011

foo()
{
}

defines a function in bash.

Usecases

Delete linebreaks

cat file | tr '\

' '; ' > newfile

TroubleShooting

If you want every line to be shown with evaluated values, write the following to the beginning of the script:

set -x

or -xv for verbose