Skip to content

Instantly share code, notes, and snippets.

@nealey
Created September 21, 2017 17:19
Show Gist options
  • Save nealey/38112f50f379e5df89e1eddd7afc0243 to your computer and use it in GitHub Desktop.
Save nealey/38112f50f379e5df89e1eddd7afc0243 to your computer and use it in GitHub Desktop.
Shell function to block until files are written
# 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