> Am 24.04.2017 um 14:58 schrieb Greg Wooledge <wool...@eeg.ccf.org>: > > On Mon, Apr 24, 2017 at 07:49:36AM -0500, Eduardo Bustamante wrote: >> On Mon, Apr 24, 2017 at 7:44 AM, Greg Wooledge <wool...@eeg.ccf.org> wrote: >> [...] >>> The outer (( )) in the C-style for loop already create an arithmetic >>> expression context. You don't need to use $(( )) inside them. You can >>> simply write: >>> >>> for (( INDEX=0; INDEX<10-${#V_NAME};; INDEX++ )) >> >> I think this is just to show the bug. i.e. these two should do the same: >> >> dualbus@debian:~$ bash -c 'for (( ; $(($(:))); )); do :; done' >> bash: -c: line 0: syntax error near unexpected token `newline' >> bash: -c: line 0: `for (( ; $(($(:))); )); do :; done' >> >> dualbus@debian:~$ bash -c 'for (( ; $((`:`)); )); do :; done' > > Yeah, I'm not disputing whether there's actually a bug here, just > pointing out that the code can be simplified to avoid it. The fact that > no sane person should write code this way is probably why the bug went > undiscovered for so long.
AFAICS in version 4.2.45(1) it works as expected. -- Reuti > Seriously, "expr length"?! In a script that is already using bashisms?
signature.asc
Description: Message signed with OpenPGP using GPGMail