redirection

Björn Lindberg d95-bli at nada.kth.se
Wed Jul 7 07:05:00 PDT 2004


Patrick Head <patrick at phead.net> writes:

> On Wed, 2004-07-07 at 06:05, Archaic wrote:
> > I've come across a need I never had before and can't figure out the
> > proper syntax. Take this example: make check 2>&1 &> check.log
> > 
> > Works great, but now I need to append, but make check 2>&1 &>> check.log
> > doesn't work.
> > 
> 
> Why are you using the '&' symbol before the non qualified (stdout)
> redirect?  I just tried using '2>&1 >>check.log' and all was well.
> 
> Maybe I am missing something, but the '&' is used to tell the shell
> to redirect to the same place as an existing file descriptor, so I
> don't think the '&' used in place of a file descriptor means much.

&> is bash special notation for redirecting both standard output and
standard error to the same place.

  foo &> bar

is equivalent to

  foo > bar 2>&1


Björn



More information about the lfs-chat mailing list