🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Rob Pettengill Mon, 12 Jun 1989 22:03
should argument substitution work in aliases?
#1014
Author: Rob Pettengill
Date: Mon, 12 Jun 1989 22:03
18 lines
728 bytes
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
should argument substitution work in aliases?
#1016
Author: Jeff Kellem
Date: Mon, 12 Jun 1989 23:42
22 lines
1027 bytes
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
Re: should argument substitution work in aliases?
#1020
Author: David C Lawrence
Date: Tue, 13 Jun 1989 00:42
22 lines
1650 bytes
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
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