#!/bin/bashstr="zs123"for ((i=1;i<=3;i++));doread -p "請輸入第$i次密碼:" scif [ $sc ]; then #判斷sc是否爲空if [ $sc = $str ];then #判斷2個字符串是否相同echo "密碼輸入正確"; breakfielseecho "密碼輸入錯誤,第$i次。"fidonebash