🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #965

'case' broken?

#965
From: Jun Hamano
Date: Sat, 26 Dec 1992 04:40
36 lines
1140 bytes
I found a small incompatibility between bash 1.12 and /bin/sh
SunOS 4.1.2.  I'm not sure if this is a bug, or `implementation
defined' incompatibility.

The following code shows that bash's `case' thinks a string
`abcd' matches *<newline>* while /bin/sh does not.

-- >8 -- 
shadow 100) bash -c 'echo $BASH_VERSION'
1.12.1
shadow 101) cat case.sh
NL='
'

for i in "$@"
do
	case $i in
	*$NL*) echo "case: $i: newline detected"
	esac
done
shadow 102) /bin/sh case.sh abcd 'ab
> cd'
case: ab
cd: newline detected
shadow 103) bash case.sh abcd 'ab
> cd'
case: abcd: newline detected
case: ab
cd: newline detected
shadow 104) 
-- >8 -- 
--
      |
   __-+-__      Jun Hamano
_-+ (|o|) +-_   junio@twinsun.com
  !   .   !
Technical Details
Message-ID: <bk6K|#cx@twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!junio

Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!junio
From: junio@twinsun.COM (Jun Hamano)
Subject: 'case' broken?
Message-ID: <bk6K|#cx@twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: Twin Sun, Inc. (El Segundo CA)
Distribution: gnu
Date: Sat, 26 Dec 1992 04:40:15 GMT
Approved: bug-bash@prep.ai.mit.edu
Lines: 37