When I run below script, it reads a report.txt file and whenever a message is matched in the file a pop up window will come with the message. How whiptail can be used out of for loop so that pop up windows comes only once with list of all messages. And the strings to be saved in a file with 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
CodePudding user response:
Remove line with whiptail and replace last done with:
done | whiptail --title "Report Error" --msgbox "$(< /dev/stdin)" 15 78
