【发布时间】:2015-09-16 00:44:40
【问题描述】:
有人介意帮助我了解以下 IF 语句吗?
read -e -p "现在要重启吗?:" -i " " REBOOT
if $REBOOT = 'yes' ; then
echo 'System will now reboot'
shutdown -r now
else $REBOOT != 'yes'
echo 'You have chosen to reboot later'
fi
如果我输入“是”,我会得到以下无休止的结果
= yes
= yes
= yes
...
= yes
如果我输入“否”,我会得到以下信息:
./test.sh: line 7: no: command not found
./test.sh: line 10: no: command not found
You have chosen to reboot later
有什么想法吗?
【问题讨论】:
标签: linux bash if-statement scripting