Re: Functions or aliases?
George Cristian Birzan wrote:
I presume you meant pushd instead of puhsd. I just ran a trial
on this tip and it doesn't seem to return to the state before
win+ was executed -- /mnt/hda1 remains in the prompt. I've
never had a problem with alias win-='cd; umount /mnt/hda1' so
On Sun, May 09, 2004 at 10:12:17AM +0200, Vincent Lefevre wrote:
On 2004-05-08 22:00:38 -0400, alex wrote:
alias win+='mount -t vfat /dev/hda1 /mnt/hda1; cd /mnt/hda1; ls
-aF --color=auto' (This is located in /root/.bashrc)
I've read that aliases should be limited to simpler
commands such as:
alias cd..='cd ..' or alias lsl='ls -l'
and that aliases like my win+ should be structered as a function
instead of an alias.
Not really. You only need functions when doing more complex things. You
can only get the arguments passed when using a functions, and you can
only 'return' when using a function.
Oh. About unmounting, you could try something like:
alias win-='puhsd ~/; unmout /dev/hda1; popd', so you get back to where
you were when you run it.
I guess I'll stay with it.