On 12/2/16 6:23 AM, parasite parasite wrote: > GNU bash, version 4.3.46(1)-release (x86_64-unknown-linux-gnu) > GCC: (GNU) 6.1.1 > On archlinux 4.4.27-1-lts > > Hello, today i tried something simple but it leads to what seems to be a bug. > > $ var="$(for ((i=0;i<$#;i++));do echo line;done)" > leads to: "unexpected EOF while looking for matching `)' > > I think it's because bash interprets "^#" as "#" which means that what > follow is commented.
Thanks for the report. What happens is that bash skips over the `$' and assumes that the `#'' starts a word. An easy workaround is to precede the `$' with a space. I'll fix it in the next devel branch push. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/