我想提出一個劇本,我的學校,我不知道我怎麼會檢查文件,如果該字符串不是在文件中,做一個代碼,但如果是繼續,就像這樣:雖然文件不包含字符串BASH
while [ -z $(cat File.txt | grep "string") ] #Checking if file doesn't contain string
do
echo "No matching string!, trying again" #If it doesn't, run this code
done
echo "String matched!" #If it does, run this code
所以...你有什麼問題 –