|
| From: | Andreas Schwab |
| Subject: | Re: doesn't bash do variable subst. or quote removal on function statement |
| Date: | Sun, 10 Jan 2016 12:59:48 +0100 |
| User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Linda Walsh <bash@tlinx.org> writes:
>> shopt -s expand_aliases; alias my=declare
>> declare fn=myfunc ## function name in variable
> doesn't work
>> function $fn { echo $fn ; }
> -bash: `$fn': not a valid identifier
>>my -pf myfunc
> -bash: declare: myfunc: not found
>>
>> def="function $fn () { echo $fn ; }" ## but same statement, eval'd works
That's not the same statement. The same statement would be
def='function $fn () { echo $fn ; }'
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
| [Prev in Thread] | Current Thread | [Next in Thread] |