On Thu, Aug 18, 2011 at 6:46 AM, Linda Walsh <coreut...@tlinx.org> wrote:
>
>
>
> ` Eric Blake wrote:
>>
>> On 08/15/2011 04:40 PM, Sam Steingold wrote:
>>>>
>>>> * Andreas Schwab<fpu...@yvahk-z68x.bet>  [2011-08-15 22:04:04 +0200]:
>>>> Sam Steingold<s...@gnu.org>  writes:
>>>>>
>>>>> Cool.  Now, what does this imply?
>>>>
>>>>    "For almost every purpose, shell functions are preferred over
>>>> aliases."
>>>
>>> so, how do I write
>>> alias a=b
>>> as a function?
>>> (remember that arguments may contain spaces&c)
>>
>> a() { b "$@"; }
>
> ---
> Way too easy.
> how do you declare a variable for storage in the context of the caller?
> (using a function)...
> ???
>
> The DebugPush & DebugPop routines I used needed to store
> the current func's flags in it's context -- I found it very troublesome
> inside a function, to store a value into a local variable in the caller.

Is this a question? or are you trying to make a point?

For the question (If I understand correctly):
1) Most variables don't need to be declared in bash.
2) bash4.2 introduce a new -g to declare a global variable inside a function.

For the point:
Yes the manual says "most" not "all", one interesting hack with aliases is:
http://www.chiark.greenend.org.uk/~sgtatham/aliases.html

Reply via email to