On Friday 19 January 2007 16:33, Wayne Topa wrote: > [EMAIL PROTECTED]([EMAIL PROTECTED]) is reported to have said: > > ...and have it work? Aliases don't support $1 or $@, do they?
Aliases don't support arguments *at all* in bash. From the bash docs: "There is no mechanism for using arguments in the replacement text. If arguments are needed, a shell function should be used (see FUNCTIONS below)." Also note that: "For almost every purpose, aliases are superseded by shell functions." > They do here > alias deps='apt-cache showpkg $1' > alias policy="apt-cache policy $1" > alias 4page="a2ps --medium=Letter -4 $1" If you're using bash, these may work in practice, but it isn't because of the $1, which in the " case is being expanded when the alias is defined and in the ' case is being expanded *after* the alias is evaluated, and will always be undefined. The reason it works at all is because when you alias something, the alias part is expanded and the rest of the command is left in place. Remove those $1's and you'll get the exact same effect. -- Wesley J. Landaker <[EMAIL PROTECTED]> <xmpp:[EMAIL PROTECTED]> OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2
pgpNEC8G5Nrro.pgp
Description: PGP signature