[Nottingham] Backups: How do you do yours?
Martin
martin at ml1.co.uk
Wed Mar 16 14:41:09 UTC 2011
Some very good comments all round.
> An educational note about stream redirection, the command:
>
> command >>logfile.txt
>
> Will only append stdout to the file, anything printed on stderr will be lost.
>
> To capture both streams, the following command can be used:
>
> command 2>&1>>logfile.txt
That doesn't work as intended...
To redirect both stdout and stderr to a single file, you need to use:
command >>logfile.txt 2>&1
That is: stdout is redirected to a file AND THEN stderr is redirected
to the stdout-to-file.
There's also a short form for doing that:
command &>>logfile.txt
The BASH syntax is quite an irregular mess! Almost as bad as a human language!!
Cheers,
Martin
More information about the Nottingham
mailing list