[gnu.bash.bug] n>&m redirection and alias expansion in bash 1.01

jmberkley@watnext.waterloo.edu (J. Michael Berkley) (06/27/89)

I am still having trouble with	

	foo 2>&1 > foo.out

I was always getting the error message:

	syntax error near `&%1'

With the help of an inciteful friend, I discovered that the problem
is with some of my favourite aliases:

	alias 1='%1'

It seems that bash does alias expansion after "&" even though the "&"
doesn't indicate a background job.

 Mike Berkley, University of Waterloo
 PAMI Lab
 jmberkley@watnext.waterloo.edu
 {utai,uunet}!watmath!watnext!jmberkley

PS - This is on a uVax running Ultrix and bash 1.01 compiled with
bison and gcc.

lamy@ai.utoronto.ca (Jean-Francois Lamy) (06/27/89)

jmberkley@watnext.waterloo.edu (J. Michael Berkley) writes:

>	foo 2>&1 > foo.out

(Independently of the problem with aliases): you should be saying

	foo > foo.out 2>&1 

if you want to follow "sh" usage (and bash usage if it follows sh semantics
for redirection).  Order of indirection does matter.

Jean-Francois Lamy               lamy@ai.utoronto.ca, uunet!ai.utoronto.ca!lamy
AI Group, Department of Computer Science, University of Toronto, Canada M5S 1A4