[KLUG Members] ariable substitution in bash alias

Adam Tauno Williams adam at morrison-ind.com
Fri Nov 4 12:42:46 EST 2005


> Most likely this is not possible, just wanted to confirm if I havent
> missed it.
> In the alias definition,
> alias killxyz='ps axf | grep xyz | cut -c 1-5 | xargs kill -9'

Yikes, that could be like spraying the process list with buckshot.  Why
not just "pkill -9 xyz"

> is it possible to use a variable $xyz in place of xyz?

Works for me.

aleph:~ # alias fred='echo $xyz'
aleph:~ # export xyz=wini
aleph:~ # fred
wini
aleph:~ #

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.kalamazoolinux.org/pipermail/members/attachments/20051104/9aac149d/attachment.bin


More information about the Members mailing list