Possible Duplicate:
Shell Script: How to pass command line arguments to an UNIX alias?
How do I insert arguments into a bash alias?
for example,
whenever I create a new directory & I cd
into it most of the time but for that I have to run two commands.
$ mkdir directory
$ cd directory
so, I was wondering if it is possible to create a new directory & switch to it in singly commands. tried to add the following alias in my .bashrc file:
alias mkdir="mkdir $@ && cd $@"
so, I could call it normally mkdir directory
& it would create & then switch to that directory. But no dice, it didn't work!
Any pointers on how can I insert arguments into an alias?