Incorrect alias substitution

2009-02-24 Thread Vincent Lefevre
I get the following errors with bash 3.2.39 under Debian/unstable:

bash -c 'alias a=echo OK 2
 a
  /dev/null a'
bash: line 1: a: command not found
bash: line 2: a: command not found

$ bash --posix
bash-3.2$ alias a=echo OK 2
bash-3.2$ a
OK
bash-3.2$  /dev/null a
bash: a: command not found
bash-3.2$ 

ksh93 doesn't yield such errors. And concerning the last one, bash is
the only shell I've found that yields such an error.

-- 
Vincent Lefèvre vinc...@vinc17.org - Web: http://www.vinc17.org/
100% accessible validated (X)HTML - Blog: http://www.vinc17.org/blog/
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




Re: Incorrect alias substitution

2009-02-24 Thread Paul Jarc
Vincent Lefevre vinc...@vinc17.org wrote:
 I get the following errors with bash 3.2.39 under Debian/unstable:

 bash -c 'alias a=echo OK 2
  a
   /dev/null a'
 bash: line 1: a: command not found
 bash: line 2: a: command not found

aliases aren't expanded by a non-interactive bash by default.  If you
do shopt -s expand_aliases, then they'll be expanded.


paul




Re: Incorrect alias substitution

2009-02-24 Thread Vincent Lefevre
On 2009-02-24 19:32:05 -0500, Paul Jarc wrote:
 Vincent Lefevre vinc...@vinc17.org wrote:
  I get the following errors with bash 3.2.39 under Debian/unstable:
 
  bash -c 'alias a=echo OK 2
   a
/dev/null a'
  bash: line 1: a: command not found
  bash: line 2: a: command not found
 
 aliases aren't expanded by a non-interactive bash by default.  If you
 do shopt -s expand_aliases, then they'll be expanded.

I can see that a is expanded if I use --posix.
But  /dev/null a is not expanded, while the other shells expand it.

-- 
Vincent Lefèvre vinc...@vinc17.org - Web: http://www.vinc17.org/
100% accessible validated (X)HTML - Blog: http://www.vinc17.org/blog/
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




Re: Incorrect alias substitution

2009-02-24 Thread Mike Frysinger
On Tuesday 24 February 2009 21:14:46 Vincent Lefevre wrote:
 On 2009-02-24 19:32:05 -0500, Paul Jarc wrote:
  Vincent Lefevre vinc...@vinc17.org wrote:
   I get the following errors with bash 3.2.39 under Debian/unstable:
  
   bash -c 'alias a=echo OK 2
a
  
 /dev/null a'
  
   bash: line 1: a: command not found
   bash: line 2: a: command not found
 
  aliases aren't expanded by a non-interactive bash by default.  If you
  do shopt -s expand_aliases, then they'll be expanded.

 I can see that a is expanded if I use --posix.
 But  /dev/null a is not expanded, while the other shells expand it.

same behavior can be seen when typing things manually in an interactive shell
-mike


signature.asc
Description: This is a digitally signed message part.