Re: Bug: 'case' in command substitution not handled correctly

2009-04-16 Thread Bernd Eggink

Chet Ramey schrieb:

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.


That fixes it, thanks.

Bernd

--
Bernd Eggink
http://sudrala.de




Re: Bug: 'case' in command substitution not handled correctly

2009-04-15 Thread Chet Ramey
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, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.0 -0400
--- parse.y 2009-04-15 22:27:56.0 -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. */