Bernd Eggink wrote: > GNU bash, Version 4.0.17(1)-release (i686-pc-linux-gnu) > > The shell doesn't recognize the closing parenthesis of a command > substitution if a 'case' command is included and 'esac' is preceded by > newline. Example: > > x=$(case $a in >> (1) echo one >> esac >> ) >> >
Try the attached patch. A newline really is a shell meta-character. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.000000000 -0400 --- parse.y 2009-04-15 22:27:56.000000000 -0400 *************** *** 3355,3359 **** /* Meta-characters that can introduce a reserved word. Not perfect yet. */ ! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch)) { /* Add this character. */ --- 3375,3379 ---- /* Meta-characters that can introduce a reserved word. Not perfect yet. */ ! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n')) { /* Add this character. */