bug-bash
[Top][All Lists]
Advanced

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

Re: how are aliases exported?


From: Linda Walsh
Subject: Re: how are aliases exported?
Date: Fri, 13 Apr 2012 17:44:44 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666



Dennis Williamson wrote:

Aliases are intended for command line convenience. You should use
functions, which can be exported and are the correct thing to use in
scripts (and even from the command line).

"For almost every purpose, shell functions are preferred over aliases."

But, of course, you know that already.

---
        Yeah... and I've already demonstrated the 'almost' part.

It's one of those:

function _include_h { return "source <liblookup>$1" ;}


alias include='eval $( _include_h "$1")'

Near as I can tell, you can't do that in a function.
If you source a file in a function, the local vars in the file
would be local to the function -- not to the prog using the alias


I thought I did suggest that line be corrected -- so people wouldn't
think functions replace aliases...
Since for some purposes, functions cannot replace aliases.

Now that I've justified another usage (similar to previous that eval'ed a result), -- how about how do I export aliases??







reply via email to

[Prev in Thread] Current Thread [Next in Thread]