Last active
August 29, 2015 14:14
-
-
Save bhcleek/d31dee03b9fda9fb56c6 to your computer and use it in GitHub Desktop.
waitfor.sh
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
PIPE=$(mktemp -d -t pipe.XXXXXX) && mkfifo $PIPE/pipe && exec 3<> $PIPE/pipe && rm -rf $PIPE | |
OUTPUTTER &>&3 & # substitute OUTPUTTER for the command whose output should be awaited | |
LOG_PID=$! | |
grep -m1 "$1" <&3 | |
kill -SIGTERM $LOG_PID | |
exec 3<&- #close our pipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment