[comp.unix.questions] sh: case .... ==> ;; esac <==

Dan_Jacobson@ATT.COM (06/10/90)

Is there any Bourne (or "Bourne compatible") shell version that requires
me to put the last ";;" right before the "esac"?  The language
description in "An Introduction to the UNIX Shell" (Bourne/Seiden, 4.3
BSD book USD:3-23) seems to require it, though there are examples on
previous pages that omit it.

E.g.,
case $LL in
	COOL) echo this;;
	J)    echo that;; #is the ";;" needed here?
esac
-- 
Dan_Jacobson@ATT.COM	+1-708-979-6364

meissner@osf.org (Michael Meissner) (06/11/90)

In article <1990Jun9.174744.16051@cbnewse.att.com> Dan_Jacobson@ATT.COM writes:

| Is there any Bourne (or "Bourne compatible") shell version that requires
| me to put the last ";;" right before the "esac"?  The language
| description in "An Introduction to the UNIX Shell" (Bourne/Seiden, 4.3
| BSD book USD:3-23) seems to require it, though there are examples on
| previous pages that omit it.
| 
| E.g.,
| case $LL in
| 	COOL) echo this;;
| 	J)    echo that;; #is the ";;" needed here?
| esac

The Free Software Foundation shell Bash 1.04 requires it.  I dunno
about 1.05 (I'm waiting for 1.06).
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so

kaul@icarus.eng.ohio-state.edu (Rich Kaul) (06/11/90)

In article <MEISSNER.90Jun10141529@curley.osf.org> meissner@osf.org (Michael Meissner) writes:
| In article <1990Jun9.174744.16051@cbnewse.att.com> Dan_Jacobson@ATT.COM writes:
| | Is there any Bourne (or "Bourne compatible") shell version that requires
| | me to put the last ";;" right before the "esac"?
|
| The Free Software Foundation shell Bash 1.04 requires it.  I dunno
| about 1.05 (I'm waiting for 1.06).

Bash 1.05 auto inserts the ;; as you can see:

Script started on Sun Jun 10 15:30:14 1990
bash$ case $PATH in
bash>NOTHING) echo this;;
bash>*) echo that
bash>esac
Inserted `;;'
that
bash$ exit
script done on Sun Jun 10 15:30:46 1990
-=-
Rich Kaul                         | "Every man is given the key to the door
kaul@icarus.eng.ohio-state.edu    |  of heaven; unfortunately, the same key
or ...!osu-cis!kaul		  |  opens the door to hell."

meissner@osf.org (Michael Meissner) (06/11/90)

In article <KAUL.90Jun10153350@icarus.eng.ohio-state.edu>
kaul@icarus.eng.ohio-state.edu (Rich Kaul) writes:

| In article <MEISSNER.90Jun10141529@curley.osf.org> meissner@osf.org (Michael Meissner) writes:
| | In article <1990Jun9.174744.16051@cbnewse.att.com> Dan_Jacobson@ATT.COM writes:
| | | Is there any Bourne (or "Bourne compatible") shell version that requires
| | | me to put the last ";;" right before the "esac"?
| |
| | The Free Software Foundation shell Bash 1.04 requires it.  I dunno
| | about 1.05 (I'm waiting for 1.06).
| 
| Bash 1.05 auto inserts the ;; as you can see:
| 
| Script started on Sun Jun 10 15:30:14 1990
| bash$ case $PATH in
| bash>NOTHING) echo this;;
| bash>*) echo that
| bash>esac
| Inserted `;;'
| that
| bash$ exit
| script done on Sun Jun 10 15:30:46 1990

I know it inserts it.  It should not give the error message -- after
all, I may be piping stderr to someother program, and the bash is just
a subshell.  The error message is bogus.
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so

chet@cwns1.CWRU.EDU (Chet Ramey) (06/15/90)

In article <MEISSNER.90Jun11115342@curley.osf.org> meissner@osf.org (Michael Meissner) writes:

>| Bash 1.05 auto inserts the ;; as you can see:

>I know it inserts it.  It should not give the error message -- after
>all, I may be piping stderr to someother program, and the bash is just
>a subshell.  The error message is bogus.

Said error message will be gone in the next release, I think.

Chet
-- 
Chet Ramey				"...but worst of all, young man,
Network Services Group			 you've got Industrial Disease!"
Case Western Reserve University	
chet@ins.CWRU.Edu		

maart@cs.vu.nl (Maarten Litmaath) (06/16/90)

In article <1990Jun15.024859.4097@usenet.ins.cwru.edu>,
	chet@cwns1.CWRU.EDU (Chet Ramey) writes:
)In article <MEISSNER.90Jun11115342@curley.osf.org>
)	meissner@osf.org (Michael Meissner) writes:
)
)>| Bash 1.05 auto inserts the ;; as you can see:
)
)>I know it inserts it.  It should not give the error message -- after
)>all, I may be piping stderr to someother program, and the bash is just
)>a subshell.  The error message is bogus.
)
)Said error message will be gone in the next release, I think.

According to POSIX 1003.2 _and_ the V7 Bourne shell + most followups
the final `;;' can be omitted, as it should.
--
 "COBOL is the revenge of some witch burned |Maarten Litmaath @ VU Amsterdam:
   in Salem, [...]"  (Bill Davidsen)  |maart@cs.vu.nl, uunet!cs.vu.nl!maart

carroll@bcsaic.UUCP (Jeff Carroll) (06/26/90)

In article <326@nyet.UUCP> pete@nyet.UUCP (Pete Hardie) writes:

>There is also a largish body of research that supports this view.  Most
>of the studies point to Pascal's usage of ";" as causing many errors, 
>due to the (apparent) inconsistency of placement - it's there sometimes
>but not always, and people will forget to look for it when they are
>adding code.

	I used to think this too, but then I went back and read my
Pascal textbook (which I was too busy to do when I took my first class
in Pascal). It really does make sense if you take the time to understand
it.
  

>btw, I'd also like to ask why Pascal had to have the '.' as program 
>terminator, instead of the ';' as module separator?


	Because Pascal was designed on a blackboard, with no thought of
whether it would ever have to run on a real computer. Or has everyone
forgotten that by now?

	Boy, I feel old.

	Followups to comp.lang.pascal.

	Jeff Carroll
	carroll@atc.boeing.com