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 | 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
Thread Tools Display Modes
  #1 (permalink)  
Old July 23rd, 2005, 03: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."
    case macosx:
        echo "You like Roman numerals."
    case windows:
        echo "Time to check for a virus."
    case amigados:
        echo "AmigaDOS will never die."
    case beos:
        echo "Count yourself lucky."
        echo "Why did you choose $os?"

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?

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

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.


Reply With Quote

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 22nd, 2008 11:29 PM
if or switch Dink Classic ASP Databases 2 February 4th, 2007 03:00 AM
switch statement seymour_glass C# 5 January 23rd, 2007 11:08 PM
Switch rajuru Beginning PHP 2 February 9th, 2005 10:24 AM

All times are GMT -4. The time now is 06:45 AM.

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