On Thu, 12 Dec 2002, Bill Shirley wrote: > I'm trying to make an bash alias do what I want an things are not > working as > expected. > > [root@server1 samba]# alias ta='echo /var/log/samba/log.${1:-smbd}' > [root@server1 samba]# ta > /var/log/samba/log.smbd > [root@server1 samba]# ta server2 > /var/log/samba/log.smbd server2 > > I would think the second invocation of ta to produce: > /var/log/samba/log.server2 > > but it doesn't. Is there something I don't understand? > I think the error you're getting is from when/where the positional parameters are expanded: If you do alias foo='echo x $1 y $2 z $3' foo a b c You'll get xyz abc
This is because it doesn't know about the positionals and is just doing: echo x $1 y$2 z $3 abc To get around this you can use a sourced function: function foo{ echo x $1 y $2 z $3 } You can put this in your .bash_profile or .bashrc to be available anytime.
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com