shell脚本问题read: Illegal option -t


执行shell脚本read.sh出现的问题

#!/bin/bash
read -t 20 -s -p "输入密码:" p1
echo
read -t 20 -s -p "再次输入密码:" p2
printf "\n"
if [ $p1 == $p2 ]
then
echo "ok"
else
echo "false"
fi

unbuntu上运行对于 -s参数

bash read.sh和 ./read.sh可以正确执行,对于sh read.sh不能正确执行,报错

read.sh: 2: read: Illegal option -t

read.sh: 4: read: Illegal option -t

对于参数选项 -n 也是一样的


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM