home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15947 < prev    next >
Encoding:
Internet Message Format  |  1993-01-25  |  1.2 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!hal.com!darkstar.UCSC.EDU!cats.ucsc.edu!caedmon
  2. From: caedmon@cats.ucsc.edu (Jeff A Ishaq)
  3. Newsgroups: comp.unix.questions
  4. Subject: Simple C shell ? regarding switch
  5. Message-ID: <1k2f0bINNjdi@darkstar.UCSC.EDU>
  6. Date: 26 Jan 93 04:34:19 GMT
  7. Organization: University of California, Santa Cruz
  8. Lines: 33
  9. NNTP-Posting-Host: am.ucsc.edu
  10.  
  11.  
  12. The only book I have on C shell programming has a cheesy example, so I
  13. couldn't derive the correct format.  Can somebody tell me how I can
  14. set up a simple switch statement?  Assume
  15.  
  16. echo "Type your choice (1-4 or Q to exit)"
  17. set selection=$<
  18.  
  19. switch ($selection)
  20.     1:
  21.        echo "You typed one!"
  22.        breaksw
  23.     2:
  24.        echo "You didn't type 1, 3, 4, or q."
  25.        breaksw
  26.     3:
  27.     4:
  28.     Q:
  29. endsw
  30.  
  31. I assume the reason this doesn't work is I need to do something 'special'
  32. to 1:  -- something like '1': ?  Ideas?
  33.  
  34. thanks,
  35. -jq
  36.  
  37.     
  38.     
  39. -- 
  40. ,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,
  41. ,;';,   caedmon@ucscb.ucsc.edu               Jeff Ishaq          .,;';,
  42. ,;';,   I am a meatball:  Bite me.           Guitar withdrawal!  .,;';,
  43. ,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,.,;';,
  44.