Possible Duplicate:
How to pass parameters to an alias?
I am trying to make a bash alias that will allow me to quickly make an archive of the current git repo.
My current alias is:
alias gitarch="git archive master --format=tar | gzip >$@"
This works great if I supply a destination file exactly like gitarch ~/Desktop/MyArchive.tar.gz
but I want to be able to just type a filename and it will always save to the desktop with the tar.gz extension. I tried doing:
alias gitarch="git archive master --format=tar | gzip >~/Desktop/$@.tar.gz"
... but it doesn't seem to work correctly.
Can anyone tell me the secret to getting this working?
alias sayhello='echo "sayhello $@ and something else"'
and then you typesayhello Dario
it will showsayhello and something else Dario
. That is the problem of the $@ you used. You're creating a.tar.gzYOURNAME
file, so that the file should be hidden =P – D4RIO Jan 13 '12 at 21:05