Null word breaks /bin/sh's "case"? HP9000's only?

Bruce Townsend bruce at bnr-vpa.UUCP
Sat Nov 16 09:20:19 AEST 1985


#!/bin/sh
#
#The following sh script should print "Case NULL works",
#but instead prints "Case NULL broken".  Is this behaviour
#limited to:
#	1) All /bin/sh's (it *should* work that way)
#	2) USG systems
#	3) Sys V.2
#	4) HP9000 (running HPUX)
#	5) HP9000 (running HPUX Ver 5.01)
#	6) My imagination?
#

#!/bin/sh
# Test /bin/sh's case with NULL words:
#
word=
case "$word" in
"") echo Case NULL works ;;
*)  echo Case NULL broken ;;
esac
exit 0

This apparent bug has broken several shell scripts, notably
Larry Wall's Configure script included with the rn distribution.

If you have help to offer, perhaps mail to me would be more
appropriate than "followup".

Thanks for your help-
-- 
			-Bruce Townsend

			Voice Processing Applications,
			Bell-Northern Research,
			Ottawa, Ontario.

Mail path: {utzoo, utcs, bnr-di, bnr-mtl}!bnr-vpa!bruce



More information about the Comp.unix.wizards mailing list