Created
September 21, 2017 17:19
-
-
Save nealey/38112f50f379e5df89e1eddd7afc0243 to your computer and use it in GitHub Desktop.
Shell function to block until files are written
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
# while await-change *.c; do make && ./run; done | |
await_change () { | |
ts=/tmp/await-change.$$ | |
: >$ts | |
while sleep 0.3; do | |
for fn in "$@"; do | |
if [ $fn -nt $ts ]; then | |
rm -f $ts | |
return | |
fi | |
done | |
done | |
} | |
alias await-change=await_change |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment