[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Functions or aliases?



On 2004-05-10 00:02:44 +0300, George Cristian Birzan wrote:
> 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.
> > 
> > I agree.
> 
> Not really. You only need functions when doing more complex things.

Of course. In many cases like for win+, functions are not needed
(if one considers that the user will always type "win+" without
anything else). But functions help by controlling the arguments
and behave more consistently when there are redirections and &.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
Championnat International des Jeux Mathématiques et Logiques, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



Reply to: