I would like to display a dialog box using zenity or dialog or something similar based on a specific string displayed in console window?

Background: I have created a wrapper shell script which calls Tomcat 7 catalina.sh. I want to display a info box with a OK message when "Server startup in XXXXXms" is outputted to the console. I dont want to edit the catalina.sh as its prone to changes or overwritting. So I need to do this in wrapper shell script.

Is the above possible?



Completely untested:

/path/to/catalina.sh 2>&1 | while IFS= read -r line; do
    echo "$line"
    if [[ $line == *"Server startup in"* ]]; then
        dialog --msgbox "$message" 10 40
  • Should message be line? – Jeff Schaller Sep 25 '18 at 14:28
  • That is a question for @Anas to answer. – glenn jackman Sep 25 '18 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.