javalee兄.你可能觉得帮我做作业比教我更容易.但我能学到什么呢?
我希望能自己做.tram兄.我是有加空格的.
#! /bin/bash
if [$#! =2]
then
echo You must input the month and years
elif [$2! ~"200*"]
then
echo Your years format is not right.
fi
这样会错吗?
其实我的作业就是写个mycal实现cal的功能.可以用cal
我总不能写一句cal $1 $2就行了吧?但又不知道加什么好.就画蛇添足.加了两个判断参数的语句.
[st1866@localhost st1866]$ cat mycal
#! /bin/bash
if [$#! = 2]
then
echo You must input the month and years
elif [[$2! = "200*"]]
then
echo Your years format is not right.
cal $1 $2
fi
[st1866@localhost st1866]$ mycal
/home/st18xx/st1866/mycal: [0!: command not found
/home/st18xx/st1866/mycal: [[!: command not found
[st1866@localhost st1866]$
不加空格不行.加了空格也这样.真奇怪.