I'm running a remote executable which produces a logfile.
I want to write a script to check whether the executable is run successfully or encounters an error. The way I can do this is by looking at the growing log file and seeing if the string "error"
or "success"
occurs first.
I know I can grep a file in realtime using
tail -f output.log | grep --line-buffered "string"
However, can I write a script which will tell me whether the grep for "error"
or the grep for "success"
occurs first?