此脚本主要实现把你所输入的内容隐藏起来,然后再读出来,其实这个脚本本身没有什么意义,在此只不过是把用法展式出来.
[root@rs1 ~]# cat answer.sh
#!/bin/sh
# Author: jackylau
# My Blog:
# Discreption: read your answer
while :;
do
echo -n "Please input your answer:"
stty -echo
read answer
case "$answer" in
[Y|y]*)
echo
echo "Your answer is $answer"
stty echo
exit;;
[N|n]*)
echo
echo "Your answer is $answer"
stty echo
exit;;
*)
echo
echo "Please Enter [y*/n*/Y*/N*]"
stty echo
continue;;
esac
done
阅读(344) | 评论(0) | 转发(0) |