Created
August 10, 2012 09:35
-
-
Save kaihendry/3312962 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| wait_for() # http://stackoverflow.com/questions/11827252 | |
| { | |
| np=$(mktemp -u) | |
| mkfifo $np # named pipe needed to get output out of inotifywait | |
| inotifywait -m -e create "$(dirname $1)" > $np 2>&1 & | |
| ipid=$! | |
| while read output | |
| do | |
| if test -p "$1" | |
| then | |
| kill $ipid | |
| break | |
| fi | |
| done < $np | |
| rm -f $np | |
| } | |
| wait_for /tmp/foobar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment