
Originally Posted by
pl@yer
Only the last command in the alias gets the passed argument.
Hi, thats not strictly true. when bash encounters an alias it just expands that alias, it doesn't pass it any arguments.
so in your example:
Code:
alias cd="echo changing to $1;cd $1;echo changing $1"
cd Downloads/
your cd Downloads command gets expanded to:
Code:
echo changing to $1;cd $1; echo changing $1 Downloads/
$1 is empty, so it ends up as:
Code:
echo changing to ;cd; echo changing Downloads/
which i guess is why it looked to you like the last command was getting passed the argument.