home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!hal.com!darkstar.UCSC.EDU!cats.ucsc.edu!caedmon
- From: caedmon@cats.ucsc.edu (Jeff A Ishaq)
- Newsgroups: comp.unix.questions
- Subject: Simple C shell ? regarding switch
- Message-ID: <1k2f0bINNjdi@darkstar.UCSC.EDU>
- Date: 26 Jan 93 04:34:19 GMT
- Organization: University of California, Santa Cruz
- Lines: 33
- NNTP-Posting-Host: am.ucsc.edu
-
-
- The only book I have on C shell programming has a cheesy example, so I
- couldn't derive the correct format. Can somebody tell me how I can
- set up a simple switch statement? Assume
-
- echo "Type your choice (1-4 or Q to exit)"
- set selection=$<
-
- switch ($selection)
- 1:
- echo "You typed one!"
- breaksw
- 2:
- echo "You didn't type 1, 3, 4, or q."
- breaksw
- 3:
- 4:
- Q:
- endsw
-
- I assume the reason this doesn't work is I need to do something 'special'
- to 1: -- something like '1': ? Ideas?
-
- thanks,
- -jq
-
-
-
- --
- ,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,
- ,;';, caedmon@ucscb.ucsc.edu Jeff Ishaq .,;';,
- ,;';, I am a meatball: Bite me. Guitar withdrawal! .,;';,
- ,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,
-