[gnu.bash.bug] should argument substitution work in aliases?

rcp@perseus.sw.mcc.com (Rob Pettengill) (06/13/89)

It doesn't seem to work as I would expect ...

perseus:/usr/stp/rcp 66=> bash -version
GNU bash, version 0.99
1=> alias foo="echo .\!*."
2=> foo bar barf
.!*. bar barf
3=> alias foo="echo .\$*."
4=> foo bar barf
.. bar barf
5=> alias fooo="echo .$1 $2."
6=> fooo barr barff
. . barr barff
7=> baz () { echo $*; }
8=> baz bar barf
bar barf

;rob

composer@BU-CS.BU.EDU (Jeff Kellem) (06/13/89)

In aliases, no. (as far as I know.)
To note: if you look at what bash sorted as your alias for say ...
	bash$ alias foo="echo .$1.$2."
	bash$ alias foo
	alias foo="echo ..."
you will get the above, with the $1, $2, etc being interpreted 
when you define the alias.	

But, in functions..yes, just as in your last try.
which is as follows ...

> 7=> baz () { echo $*; }
> 8=> baz bar barf
> bar barf

Enjoy...

                                -jeff

Jeff Kellem
INTERNET: composer@bu-cs.bu.edu  (or composer%bu-cs.bu.edu@bu-it.bu.edu)
UUCP: ...!harvard!bu-cs!composer

tale@pawl.rpi.edu (David C Lawrence) (06/13/89)

In <8906122342.AA11340@bu-cs.BU.EDU> composer@BU-CS.BU.EDU (Jeff Kellem):
> In aliases, no. (as far as I know.)

This is the way bash really wants to do things?  If the intent is to
make people use function definitions when they want argument
substitution, then fine; however, if the intent is to provide an alias
mechanism similar to that of other interactive shells, then it falls
short.  Even abbrevs in Primos allow argument substitution and
Primos is brain-damaged.  (My opinion only; if you like Primos I
really don't want to hear about it.)

I rarely use aliases in csh (far fewer than my peers seem to have) but
of the five that I have, four use the \!* mechanism to stuff things
into a pipeline.  Not having argument substitutions makes those four
useless, but I could rewrite them as functions in bash.  What is the
real intent of bash aliases?

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))
  "I realize the Internet isn't the whole world, but it is the center of it."
                                                        -- Greg Woods