linux shell script问题
极光默尘 2011-01-06 02:32:54 谁能帮我看下为什么下面的代码没法运行,而是显示“declare:not found" 还有一些错误的信息
declare -i number
for option in $@
do
number=number+1
case $option in
-f)
date=`date +%Y%m%d`
host=`hostname`
if [ $number -eq 1 ];then
echo "檔案無資料儲存"
break
else
number=number+1
file=`echo $@ | cut -d " " -f $number`
if [ "$file" != "" ];then
print_time>>"$file.$date"
print_user>>"$file.$date"
print_disk>>"$file.$date"
else
print_time>>"$host.$date"
print_user>>"$host.$date"
print_disk>>"$host.$date"
fi
break
fi
;;
*)
echo "$option command not found"
exit 1
esac
done