test -f
測試檔案 sh03.sh 及 sh0y.sh 是否存在?
[dywang@dywmac zzz]$ test -e sh03.sh && echo "exist" || echo "not exist" exist [dywang@dywmac zzz]$ test -e sh0y.sh && echo "exist" || echo "not exist" not exist
[dywang@dywmac zzz]$ vim sh05.sh [dywang@dywmac zzz]$ cat sh05.sh #!/bin/bash read -p "請輸入一數字: " -t 5 num test "$num" -gt "10" && echo "$num>10" || echo "$num<=10" exit 0
[dywang@dywmac zzz]$ sh sh05.sh 請輸入一數字: 10 10<=10 [dywang@dywmac zzz]$ sh sh05.sh 請輸入一數字: 45 45>10 [dywang@dywmac zzz]$ sh sh05.sh 請輸入一數字: -3 -3<=10