执行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 也是一样的