🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jun Hamano Sat, 26 Dec 1992 04:40
'case' broken?
#965
Author: 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
  !   .   !
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads