Null Word in Case Works? - Survey results
Bruce Townsend
bruce at bnr-vpa.UUCP
Thu Dec 12 08:20:47 AEST 1985
Summary of Responses to "Null Word in /bin/sh Case Statement Works?":
A while ago I posted the following question to the net:
#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
Thanks to all who responded. My mail ran in favor of
answer (5): HP9000 (running HPUX Ver 5.01, a Sys V.2 port).
There were 14 "works on my system" responses, and two "doesn't
work" results. A summary of the "works here" is given, followed
by the two opposite comments:
Works on:
1) Sys5R2 on 3B20 (ttrdc!levy)
2) V7 as implemented for the Sys V shell in Release 2.2 by
Unisoft for the Pixel (globetek!chris)
3) Vax 11/750. (celerity!barto)
4) System V, Rel 2, VAX. (mot!fred)
5) SYSTEM V/68, the AT&T certified port of System V,
Rel 2 to the 680x0 family. (motet1!root)
6) our System Vr2 system using both /bin/sh and /bin/ksh. (pegasus!hansen)
7) 4.1 bsd system with both the 4.1 /bin/sh, *and* SVr2 /bin/sh (warwick!steve)
8) VAX 780 running System V.2.2.... (somewhere!devine)
9) VAX using the LOCUS Distributed Operating System, both the
BSD4.1 and the Sys V versions of /bin/sh. (lcc!richard)
10) AT&T 3b2 SYS V.2. (gwsd!revc)
11) 4.2 or 4.3 on Vaxen, and Suns. (csl!west)
12) V.2 VAX 750 (cray!hrp)
13) xenix, shell probably untouched since V7. (ki4pv!tanner)
14) Eighth Edition system; the V8 shell is SysVr2 with Rob Pike's hacks
(basser.oz!john)
DOES NOT WORK ON:
1) (cwruecmp!ccc)
Apparently this behavior (although unexpected) occurs in nearly all Bourne
shells. As a matter of fact, even though we run SYS5R2 on our 3B2's, we
also have V7 (VENIX) running on a PRO/350, and it exhibits the same behavior
(after stripping any "#" comments). I hope this helps your investigation.
Carl Fongheiser
2) (hpfcla!ajs)
I believe the answer is (3). I have a shell script which had a similar
case (literally), and it broke with the HP-UX 5.0 release because of the
upgrade to the AT&T V.2 sh(1), which was largely rewritten (thus
introducing, in fact, a number of anomalies). I've reported the bug
internally. I apologize that this change, among others, was not
thoroughly documented along with the 5.0 update.
-
Alan Silverstein, Hewlett-Packard Fort Collins Systems Division, Colorado
{ihnp4 | hplabs}!hpfcla!ajs, 303-226-3800 x3053, N 40 31'31" W 105 00'43"
--
-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