Scripting

From Linuxintro
Revision as of 12:35, 23 January 2014 by imported>ThorstenStaerk (export-import does not work with "\n")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
foo()
{
}

defines a function in bash.

Usecases

Delete linebreaks

cat file | tr '\n' '; ' > 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

See also