[NTLUG:Discuss] An Oddity (bug) in Redhat 7.1

Steve Baker sjbaker1 at airmail.net
Sun Oct 28 15:01:27 CST 2001


Kenneth Loafman wrote:
> 
> 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 ***

Eh!?  Which version number does bash return?  2.03 under SuSE Linux seems
to allow both &> and >& .  I agree with you that >& is correct - but 'Bourne'
shells typically don't support it - that's a 'csh' shell mechanism.  tcsh (for
example) allows >& but &> is interpreted thus:

  echo "Hello World"  &> temp

...the shell sees this as a request to run 'echo' in background:

  echo "Hello World" &

...followed by a null command whose stdout is redirected to the file 'temp'.
It just gives an error for the null command.

Bourne shell (and hence, I would have thought - 'bash') uses

    N>

(Where N is a file descriptor number).

Hence:

    2> 

Should redirect stderr.

There are just *so* many things that are strange under RedHat 7.x

-- 
    NOTE: MY HOME PAGE HAS MOVED TO http://www.sjbaker.org - PLEASE
               UPDATE YOUR LINKS AND BOOKMARKS ACCORDINGLY!

----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1 at airmail.net>   WorkMail: <sjbaker at link.com>
URLs : http://www.sjbaker.org
       http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
       http://prettypoly.sf.net http://freeglut.sf.net
       http://toobular.sf.net   http://lodestone.sf.net



More information about the Discuss mailing list