BASH脚本输入选项后回话退出

wffger 发布于 2013/12/21 09:44
阅读 329
收藏 0
[s11511@linux ~]$cat case.sh
#!/bin/bash
read -p "Input a file name:" file
if [ ! -f $file ]
then echo "$file must be ordinary file"
exit 1
fi
if [ -s $file ]
then echo "option:
        -d|D:delete file
        -s|S:show file detail information
        -q|Q:quit"
fi
read -p "Input your option:" option
case "$option" in
d|D) rm -r $file
;;
s|S) ls -l $file
;;
q|Q) exit 0
;;
*) echo "Invalid option"
exit 1
;;
esac
exit 0


PuTTY telnet到RHEL执行脚本,如果脚本中出现exit 0,PuTTY的回话也被关闭。如何解决?

加载中
返回顶部
顶部