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

Re: Functions or aliases?

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. 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've tried the same command in function form and I don't see any
> > difference.
> win+ 2> error
> makes a difference (when something is sent to stderr).
> So do things like:
> [[ condition ]] && win+

[ condition ] && win+, though I don't really see what this was about.

George Cristian Birzan			gcbirzan (at) wolfheart (dot) ro
Where did you say those backup tapes were kept?

Attachment: signature.asc
Description: Digital signature

Reply to: