執行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 也是一樣的
