Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-13 Thread Chet Ramey
On 1/13/16 12:20 PM, Linda Walsh wrote: > It doesn't seem very consistent to choose (()) over [] -- why come up with > a special longer operator for arith eval, when [] was already used for > arith evaluation in array indexing?

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-13 Thread Chet Ramey
On 1/12/16 4:33 PM, Linda Walsh wrote: > > > Greg Wooledge wrote: >> On Tue, Jan 12, 2016 at 11:52:47AM -0800, Linda Walsh wrote: >> >>> Also, from a documentation standpoint, not all behaviors are documented >>> in the manpage, like: >>> >>> echo $[1+2] >>> >>> as far as I can tell, isn't

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-13 Thread Chet Ramey
On 1/12/16 2:52 PM, Linda Walsh wrote: > > > Chet Ramey wrote: >> 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? >> > Because it

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-13 Thread Linda Walsh
Chet Ramey wrote: On 1/12/16 4:33 PM, Linda Walsh wrote: --- But why? It's less noisy than any alternative. It's not as if I can type echo $(1+2) and expect it to work. Because it only ever appeared in a Posix draft standard, and there's no reason not to use the standard syntax.

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-12 Thread Linda Walsh
Greg Wooledge wrote: On Tue, Jan 12, 2016 at 11:52:47AM -0800, Linda Walsh wrote: Also, from a documentation standpoint, not all behaviors are documented in the manpage, like: echo $[1+2] as far as I can tell, isn't documented, yet not supporting its behavior would break many older

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-12 Thread Greg Wooledge
On Tue, Jan 12, 2016 at 11:52:47AM -0800, Linda Walsh wrote: > Also, from a documentation standpoint, not all behaviors are documented > in the manpage, like: > > echo $[1+2] > > as far as I can tell, isn't documented, yet not supporting > its behavior would break many older scripts That

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-12 Thread Linda Walsh
Chet Ramey wrote: 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? Because it does quote quote removal on other statements that

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-11 Thread Chet Ramey
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" () { :; } >

Re: doesn't bash do variable subst. or quote removal on function statement

2016-01-10 Thread Andreas Schwab
Linda Walsh 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 >> >>