當我在腳本下運行時,它會讀取一個 report.txt 檔案,并且只要檔案中的訊息匹配,pop up就會出現一個帶有訊息的視窗。如何whiptail在for回圈外使用,以便彈出視窗僅出現一次并包含所有訊息的串列。并the strings保存在一個檔案中time stamp。
for ((e = 1; e <= 3; e )); do
for ((m = 1; m <= 4; m )); do
message="Error$e in Machine $m"
if grep -qF "$message" /home/new/Report.txt; then
echo "$message"
whiptail --title "Report Error" --msgbox "$message" 8 78
else
echo "No Error found"
fi
done
done
uj5u.com熱心網友回復:
洗掉行whiptail并替換done為:
done | whiptail --title "Report Error" --msgbox "$(< /dev/stdin)" 15 78
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/372404.html
下一篇:如何在bash中轉換日期變數格式
