command substitution inside parameter expansion inside "for ((;;))"

2017-11-15 Thread Stephane Chazelas
Hello, $ bash -c 'for ((i = 0; $(echo 0); i++)); do echo x; done' (OK) $ bash -c 'for ((i = 0; ${x-`echo 0`}; i++)); do echo x; done' (OK) $ bash -c 'for ((i = 0; ${x-$(echo 0)}; i++)); do echo x; done' bash: -c: line 0: syntax error near unexpected token `newline' bash: -c: line 0: `for ((i =

Re: command substitution inside parameter expansion inside "for ((;;))"

2017-11-15 Thread Chet Ramey
On 11/15/17 5:13 AM, Stephane Chazelas wrote: > Hello, > > $ bash -c 'for ((i = 0; $(echo 0); i++)); do echo x; done' > > (OK) > > $ bash -c 'for ((i = 0; ${x-`echo 0`}; i++)); do echo x; done' > > (OK) > > $ bash -c 'for ((i = 0; ${x-$(echo 0)}; i++)); do echo x; done' > bash: -c: line 0: syn

$"\t': Bash bug or not?

2017-11-15 Thread Rick Richardson
$ echo "$LOGNAME " | xod Dump: standard input Offset:0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef : 72 69 63 6b 20 0a| rick . | OK! $ echo "$'\t' " | xod Dump: standard input Offset:0 1 2 3 4 5 6 7 8 9

Re: $"\t': Bash bug or not?

2017-11-15 Thread Chet Ramey
On 11/15/17 10:01 AM, Rick Richardson wrote: > $ echo "$'\t' " | xod > > Dump: standard input > > Offset:0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef > > : 24 27 5c 74 27 20 0a | $'\t' . > | > > A Bash bug??? Where's the

Re: $"\t': Bash bug or not?

2017-11-15 Thread Robert Elz
To put Chet's reply a different way, don't think of $'...' as a dollar expansion ( like ${} $() or $(()) ) it isn't, it is just another form of quoting (very similar to '' quoting) and is processed in the same way, at the same places, as '' quoting would be. In "'xxx'" the single quotes are just c

Re: command substitution inside parameter expansion inside "for ((;;))"

2017-11-15 Thread Chet Ramey
On 11/15/17 5:13 AM, Stephane Chazelas wrote: > I also noticed that cmd was not run in ${x#`cmd`} if x happens > to be empty (it's also the case in dash and ksh93 though only if > x is unset; zsh, mksh and yash are fine) It looks like bash/dash/ksh93 give more weight to the "If word is not needed