Skip to content

Instantly share code, notes, and snippets.

@kbhaines
Last active August 29, 2015 14:01
Show Gist options
  • Save kbhaines/b4d069ba609629ae64ec to your computer and use it in GitHub Desktop.
Save kbhaines/b4d069ba609629ae64ec to your computer and use it in GitHub Desktop.
File watch
#!/bin/sh
PREFIX=$1
while [ 1 ];do
for f in $PREFIX*;do
if ! lsof $f >/dev/null;then
echo $f is ready
# do something with it, then rm/mv it out of the way...
...
fi
done
echo Wait...
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment