🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by J. Michael Berkley Mon, 26 Jun 1989 22:49
n>&m redirection and alias expansion in bash 1.01
#150
Author: J. Michael Berkley
Date: Mon, 26 Jun 1989 22:49
23 lines
1028 bytes
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.
Re: n>&m redirection and alias expansion in bash 1.01
#151
Author: Jean-Francois Lamy
Date: Tue, 27 Jun 1989 11:35
13 lines
877 bytes
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
Re^2: n>&m redirection and alias expansion in bash 1.01
#165
Author: Maarten Litmaath
Date: Tue, 27 Jun 1989 21:35
17 lines
1163 bytes
lamy@ai.utoronto.ca (Jean-Francois Lamy) writes:
\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.

Precisely! What if Michael wanted to dup stderr to the original stdout and
redirect stdout to a file?
-- 
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
   they're small."  (Stephen Savitzky)    |maart@cs.vu.nl, mcvax!botter!maart
Re: Re^2: n>&m redirection and alias expansion in bash 1.01
#174
Author: J. Michael Berkley
Date: Thu, 29 Jun 1989 02:57
12 lines
1279 bytes
lamy@ai.utoronto.ca (Jean-Francois Lamy) writes:
   \if you want to follow "sh" usage (and bash usage if it follows sh semantics
   \for redirection).  Order of indirection does matter.

In article <2809@solo3.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
   Precisely! What if Michael wanted to dup stderr to the original stdout and
   redirect stdout to a file?

Argh.  I am thankful to everyone who has pointed out that my ordering
was incorrect, but the real problem is with bash and incorrect alias
expansion.  Ordering is not very important when bash is giving syntax
errors because of an alias.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads