Article View: comp.unix.shell
Article #79Re: Bourne Shell Programming Considered Harmful
From: Matt Ranney
Date: Thu, 05 Nov 1992 04:36
Date: Thu, 05 Nov 1992 04:36
40 lines
2225 bytes
2225 bytes
dave@cs.arizona.edu (Dave Schaumann) writes:
>In article <Bx4Myp.Czr@unix.amherst.edu>, twpierce@unix (Tim Pierce) writes:
>>The command syntax really sucks, man.
>Are we talking about /bin/sh here? Yah, the syntax of that is pretty
>bizzare. What's worse, the man page (at least here) is really awful.
>Recently, I wanted to add a "case" to my .xsession file. I could /not/
>figure out the syntax from the man page. I finally gave up and asked.
>Is bash any better?
I love bash, but the man page isn't much friendlier. Here's what the
manpage for sh (on a Sun) has to say about case:
case word in [pattern[ | pattern] ... ) list ;; ] ... esac
A case command executes the list associated with the
first pattern that matches word. The form of the pat-
terns is the same as that used for filename generation
(see Filename Generation) except that a slash, a lead-
ing dot, or a dot immediately following a slash need
not be matched explicitly.
And here's what the bash manpage says:
case word in [ pattern [ | pattern ] ... ) list ;; ] ... esac
A case command first expands word, and tries to match
it against each pattern in turn. When a match is
found, the corresponding list is executed. After the
first match, no subsequent matches are attempted. The
exit status is zero if no patterns are matches. Other-
wise, it is the exit status of the last command exe-
cuted in list.
Not much better. I guess the single line specification is a bit
cryptic.
--
Matt Ranney - mjr@uther.calvin.edu
"You know, I don't think theres a man, woman, or child alive today
who doesn't enjoy a lovely beverage." -DL
Technical Details
Message-ID:
<mjr.720938180@ursa>Path:
arc1-ca.pugleaf.net!sparky!uunet!gumby!ursa!ursa!mjrReferences:
<Bx4Myp.Czr@unix.amherst.edu> <1992Nov4.194832.14272@organpipe.uug.arizona.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!ursa!ursa!mjr From: mjr@ursa.calvin.edu (Matt Ranney) Subject: Re: Bourne Shell Programming Considered Harmful Message-ID: <mjr.720938180@ursa> Sender: news@calvin.edu Organization: Calvin College References: <Bx4Myp.Czr@unix.amherst.edu> <1992Nov4.194832.14272@organpipe.uug.arizona.edu> Date: Thu, 5 Nov 1992 04:36:20 GMT Lines: 40