Last active
October 21, 2019 10:03
-
-
Save andgineer/2555ba583bc675bf63e0fa399c627851 to your computer and use it in GitHub Desktop.
wait for specific string from application with timeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timeout -k 1s --preserve-status 0.5s \ | |
perl -e '$|++; print "bla-bla\n"; sleep(2); print "The end."' \ # placeholder for you process | |
| perl -pe 'END { exit $status } $status=1; if (/end/) {$status=0; exit;}' | |
# see explanation in andrey.engineer/posts/en/bash_wait_with_timeout_for_string.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description is in my blog post