[H-GEN] What the...? Weird behaviour from bash

Anthony Towns aj at humbug.org.au
Fri Feb 6 11:18:04 EST 1998


-----BEGIN PGP SIGNED MESSAGE-----

On Sat, 7 Feb 1998, Byron Ellacott wrote:

> > > ] [aj at azure ~]$ /bin/sh
> > > ] [aj at azure ~]$ echo hello | cat >& /dev/null
> > > ] hello
> > > ] [aj at azure ~]$ /bin/bash
> > > ] [aj at azure ~]$ echo hello | cat >& /dev/null
> > > ] [aj at azure ~]$ exit
 
> Now, someone recently pointed out to me that bash, when invoked as
> 'sh', disables many of it's more advanced features, and acts
> presakerly like the original bourne shell. 

Ah! Well, that explains that behaviour...

(form the bash(1) manpage)
]   Redirecting Standard Output and Standard Error
]       Bash  allows  both the standard output (file descriptor 1)
]       and the standard error output (file descriptor  2)  to  be
]       redirected to the file whose name is the expansion of word
]       with this construct.
]
]       There are two formats for redirecting standard output  and
]       standard error:
]
]              &>word
]       and
]              >&word
]
]       Of  the two forms, the first is preferred.  This is seman­
]       tically equivalent to
]
]              >word 2>&1
] [...]
]
] Manual page bash(1) line 1745/5016 35%

If I may then ask another question. 

] [aj at azure ~]$ /usr/bin/tcsh
] azure:~> echo hello | cat &>/dev/null
] Invalid null command.
] azure:~> echo hello | cat >&/dev/null
] azure:~> exit

Why don't /bin/sh, /bin/bash and /bin/tcsh all support any one of
these syntaxes? (/bin/csh is the same as /bin/tcsh, but its prompt on
azure's stuffed up, whereas tcsh's isn't...)

Cheers,
aj





















- --
Anthony Towns <aj at humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

On Netscape GPLing their browser: ``How can you trust a browser that
ANYONE can hack? For the secure choice, choose Microsoft.''
	-- <oryx at pobox.com> in a comment on slashdot.org

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii
Comment: Key available at http://student.uq.edu.au/~s343676/aj_key.asc

iQCVAwUBNNs3v+RRvX9xctrtAQGIQQP/WAgnzNG5njWJAAA75+QWesaSsP812upv
JasdqbMVDnIlwiVslDo0XbT77xG0AFxrk6/ECgK9r0M/X9DF53s+NIz+6oyvMUSq
ZLEWs5d6jf6GXJi2EknQJZohHfu5FbvbS7iuSrntD0bSSAigN154tMTByySTCiB5
s25kCdwLFF8=
=5Upi
-----END PGP SIGNATURE-----

----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list