Archive for August, 2008

Input/Output redirection, appending

Posted in Linux SysAdmin on August 15th, 2008 by Johan Huysmans – Be the first to comment

In a previous post I wrote about output redirection of STDOUT, STDERR and both to a file. Off course you can do the same to append to an existing file:

ls >> output.txt
ls 2>> error.txt

If you try this with &>> you will receive a bash syntax error:

ls &>> output_and_error.txt
bash: syntax error near unexpected token `>'

How come appending of both STDOUT and STDERR to a file does not work this way? Is this a bug in bash?
Yes, I know I can use the following, but I prefer the &>>:
ls 1>> output_and_error.txt 2>&1

And how come I can’t find a bugzilla for bash?
Yes, I know I can use the command bashbug to send a mail to a mailinglist, but this is not the same as bugzilla.