bug-bash
[Top][All Lists]
Advanced

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

Re: how are aliases exported?


From: Pierre Gaston
Subject: Re: how are aliases exported?
Date: Sat, 14 Apr 2012 08:28:28 +0300

On Sat, Apr 14, 2012 at 3:44 AM, Linda Walsh <bash@tlinx.org> wrote:

>
>
> 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??
>

you can't.


reply via email to

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