bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

&> vs. >&


From: Paul Jarc
Subject: &> vs. >&
Date: Wed, 14 Jul 2004 10:23:46 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

man bash:
# There are two formats for redirecting standard output and standard
# error:
#
#        &>word
# and
#        >&word
#
# Of the two forms, the first is preferred.

I think it's better to recommend the second form.  The first is an
incompatibility with SUSv3 (and POSIX, I assume), where "cmd &> file"
means to run cmd in the background, and truncate file.  This leads to
bad habits and portability problems.

It would also be useful to add a note for the second form that if the
word is numeric, it should be separated from >& with whitespace to
ensure it won't be confused for a descriptor dup.


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]