谢谢javalee的指点
shell的格式真的是很难把握.我才用了几天就觉得不同的shell的语法和格式真的是差别很大.刚才我试了一下.在前面加上一句
#! /bin/csh
就可以正确地运行了.
其实在case 后面的May加上双引号也是正确的.
问题是在bash下还不是不能运行.我估计不是switch的问题.
但把程序改成:
switch ($1)
case "January":
cal 1 $2
breaksw
case "February":
cal 2 $2
breaksw
case "March":
cal 3 $2
breaksw
case "April":
cal 4 $2
breaksw
case "May":
cal 5 $2
breaksw
case "June":
cal 6 $2
breaksw
case "July":
cal 7 $2
breaksw
case "August":
cal 8 $2
breaksw
case "September":
cal 9 $2
breaksw
case "October":
cal 10 $2
breaksw
case "November":
cal 11 $2
breaksw
case "December":
cal 12 $2
breaksw
default:
echo "lease input right month!
endsw
居然还不行.