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
|