Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Shell Scripting ISBN: 0-7645-8320-4
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Shell Scripting ISBN: 0-7645-8320-4
This is the forum to discuss the Wrox book Beginning Shell Scripting by Eric Foster-Johnson, John C. Welch, Micah Anderson; ISBN: 9780764583209
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Shell Scripting ISBN: 0-7645-8320-4 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 23rd, 2005, 04:37 PM
Registered User
 
Join Date: Jul 2005
Location: Minneapolis, MN, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default csh switch - breaksw: endsw not found

Page 130 of Beginning Shell Scripting.
Try it Out: Casing the C Shell

I saved the following code to file switch_os on ~/Desktop

    echo "Please enter your favorite operating system, "
    echo -n "linux, macosx, windows, amigados or beos: "
    set os = $<

    switch ( $os )

    case linux:
        echo "Way cool, yoou like Linux."
        breaksw
    case macosx:
        echo "You like Roman numerals."
        breaksw
    case windows:
        echo "Time to check for a virus."
        breaksw
    case amigados:
        echo "AmigaDOS will never die."
        breaksw
    case beos:
        echo "Count yourself lucky."
        breaksw
    default
        echo "Why did you choose $os?"
    endsw

I then ran the code using csh switch_os in the Terminal on Mac OS X (10.4.2). I receive the correct response for each case but each was followed by:

    csh: breaksw: endsw not found.

Is this expected behavior with this OS?

bill
Reply With Quote
  #2 (permalink)  
Old July 31st, 2005, 10:26 AM
Registered User
 
Join Date: Jul 2005
Location: , Minnesota, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm using MacOS X 10.4.2 (Tiger) and this script ran fine without the error you saw under both Terminal and iTerm. If you had run this under bash, you would have received an error earlier in the script, so you must be using csh. Are you using Fink or DarwinPorts by chance? I'm looking for anything that could be diffferent between our systems.

-Eric


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch mamatharocks Biztalk 0 May 23rd, 2008 12:29 AM
if or switch Dink Classic ASP Databases 2 February 4th, 2007 04:00 AM
switch statement seymour_glass C# 5 January 24th, 2007 12:08 AM
Switch rajuru Beginning PHP 2 February 9th, 2005 11:24 AM



All times are GMT -4. The time now is 08:07 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.