echo "Enter the current time: "
read h m s
s = `expr $n + 1`
if [ $n -eq 60 ]; then
s = 0
m = `expr $m + 1`
if [ $m -eq 60 ]; then
m = 0
h = `expr $h + 1`
if [ $h -eq 24 ]; then
h = 0
fi
fi
fi
echo "The time after one second is $h $m $n"
如果您输入s = 0
bash提示,则会得到bash: s: command not found
。
在bash中分配变量的正确方法是s=0
没有空格。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句