[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: doesn't bash do variable subst. or quote removal on function stateme
From: |
Chet Ramey |
Subject: |
Re: doesn't bash do variable subst. or quote removal on function statement |
Date: |
Mon, 11 Jan 2016 10:24:07 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 1/9/16 8:28 PM, Linda Walsh wrote:
> Not in a function definition (i.e. this is broken AFAIAC in bash).
It's not.
> I.e.
>> 'func' () { :; }
> -bash: `'func'': not a valid identifier
>> function 'func' () { : ; }
> -bash: `'func'': not a valid identifier
>> function "func" () { :; }
> -bash: `"func"': not a valid identifier
> ---
> That's weird. while, _maybe_ I could see the 1st one not working
> if looking for a bash keyword, but the 2nd & third forms seems odd.
> I thought variable substitution and quote-removal was supposed
> to happen before the statement is executed ??
No. The shell doesn't perform any word expansions on the `name' when
executing a function definition command. Since the documentation doesn't
say it performs any expansions, why would you assume it does?
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Re: 'official function declaration format' doesn't work if alias defined, (continued)
- Re: 'official function declaration format' doesn't work if alias defined, Reuti, 2016/01/07
- Re: aliases v. functions; command extension? (-f & -F)?, Linda Walsh, 2016/01/08
- doesn't bash do variable subst. or quote removal on function statement, Linda Walsh, 2016/01/09
- Re: doesn't bash do variable subst. or quote removal on function statement, Andreas Schwab, 2016/01/10
- Re: differences in Q.-removal, var-expansion and allowed characters in fn & var names, Linda Walsh, 2016/01/10
- Re: differences in Q.-removal, var-expansion and allowed characters in fn & var names, Chet Ramey, 2016/01/11
- Re: doesn't bash do variable subst. or quote removal on function statement,
Chet Ramey <=
- Re: doesn't bash do variable subst. or quote removal on function statement, Linda Walsh, 2016/01/12
- Re: doesn't bash do variable subst. or quote removal on function statement, Greg Wooledge, 2016/01/12
- Re: doesn't bash do variable subst. or quote removal on function statement, Linda Walsh, 2016/01/12
- Re: doesn't bash do variable subst. or quote removal on function statement, Chet Ramey, 2016/01/13
- Re: doesn't bash do variable subst. or quote removal on function statement, Linda Walsh, 2016/01/13
- Re: doesn't bash do variable subst. or quote removal on function statement, Chet Ramey, 2016/01/13
- Re: doesn't bash do variable subst. or quote removal on function statement, Chet Ramey, 2016/01/13
- Re: aliases v. functions; command extension? (-f & -F)?, Chet Ramey, 2016/01/11
- Re: aliases v. functions; command extension? (-f & -F)?, Reuti, 2016/01/11
- Re: aliases v. functions; command extension? (-f & -F)?, Chet Ramey, 2016/01/11