Re: Functions or aliases?
Vincent Lefevre wrote:
When I first read about functions, I used them but then I tried
aliases to see how they worked and never went back to functions.
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.
Aliases are more compact, easier to set up, and adapt to changes.
All I can say is that the aliases that I use have worked very
well for me and I could't detect any difference in the results
between the aliases and functions. Could you please elaborate
on why functions are preferable to aliases for compound commands?
I've tried the same command in function form and I don't see any
win+ 2> error
makes a difference (when something is sent to stderr).
So do things like:
[[ condition ]] && win+
All I know about Linux has been gleaned from the lists and web
pages so this is a bit too cryptic for my meager education.
Could you please give a few details or point me to where
there's an explanation?