[NTLUG:Discuss] An Oddity (bug) in Redhat 7.1
Kenneth Loafman
ken at lt.com
Sun Oct 28 15:14:18 CST 2001
An interesting bug was found in RH 7.1 shell. Redirection of both
stdout and stderr can be done with either >& or &>, with the first form
being predominate in use. Both are semantically equivalent according to
the bash manual. I've been using >& for years and its embedded in a lot
scripts since it works on every other distro. Not so for Redhat 7.1.
*** &> will redirect both while >& redirects nothing ***
I've attached a pair of files. Put both files in a directory, run the
'testredir' script, and you should see only two lines, and two output
files should be created. On a Redhat 7.1 system only one of the paths
works to create the log file. The test for >& seems to ignore that and
the output file name.
Just thought you'd like to know.
...Ken
-------------- next part --------------
#! /bin/sh
echo Test with \&\>
./testredir1 &> testredir1a.log
echo Test with \>\&
./testredir1 >& testredir1b.log
-------------- next part --------------
#! /bin/sh
echo testredir1 started
More information about the Discuss
mailing list