- 论坛徽章:
- 0
|
回复 3# splendid12
如您所说,我改成下面的样子了,但不管执行哪个选项都会退出,又变成[root@localhost script]_,请问这是怎么回事啊??你那里测试能用吗?
#!/bin/bash
#Program:
# For shut down
#History:
# 2012/02/29 Yu First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
###########
echo "*******************************************"
echo "**This is a shutdown operating procedures**"
echo "******Please select your of operation******"
echo "***1 Restart 2 shutdown***"
echo "***3 Timing shutdown 4 exit******"
echo "*******************************************"
read -p "Please input options:" sel
clear
read -p "are you sure your choice?(Y/N) " sur
if [ $sur == "N" -o $sur == "n" ]; then
exit 1
elif [ $sur == "Y" -o $sur == "y" ]; then
exit 0;
case $sel in
"1")
ord='shutdown -r now'
;;
"2")
ord='shutdown -h now'
;;
"3")
ord='shutdown -h -t $mm'
;;
"4")
read -p "quit?(Y/N)" sur2
if [ $sur2 == "Y" -o $sur2 == "y" ]; then
exit 0
elif [ $sur2 == "N" -o $sur2 == "n"]; then
. 'pwd'/$0
fi
;;
esac
else
echo "I don't know what's your menu......"
exit 1;
fi
|
|