Quoth T o n g: > On Sat, 26 Jan 2008 17:12:56 +0000, Tzafrir Cohen wrote: > > >> I'm wondering if you have read my OP or not. Read it again pls. > > > > Yes I have. Use functions. Don't use aliases. > > Despite its limitations, why one can't use aliases in scripts? > This sounds like "Don't use #define in C" to me (again, despite alias' > limitations please)
Aliases are just there for your (the shell's users') convenience. This way you can say something like alias pss='ps aux | grep' to be able to handle your daily work quicker. Aliases shouldn't be used in shellscripts because: a) it makes them more difficult to understand (aliases often have very unintuitive names) for other people b) it makes the whole script unportable (someone else won't have the same aliases in place) OK, those are reasons for just ignoring those two concerns, like... "That's just my script foo that accomplishes bar and locally, on my machine, nobody else is involved, no other machines are to be used, the environment stays the same..." Does it? Think again. I think it was Heraklit who said: "You can't ever go through the same river twice." The river always changes - so do you. This may be a bit philosophical, but it's rather true in the end. MY aliases change all the time. So does my environment. When I want to use a script more than once, I usually make sure it doesn't depend on anything I'm frequently (more than once or twice a year) modifying. Just my two cents ;-) Aleks
signature.asc
Description: Digital signature