Skip to content

Instantly share code, notes, and snippets.

@zph
Last active July 19, 2016 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zph/ce9944e1689b8f2ad58a64eb5c244ff7 to your computer and use it in GitHub Desktop.
Save zph/ce9944e1689b8f2ad58a64eb5c244ff7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [[ ! -x $(which fswatch) ]];then
echo "Must install fswatch"
exit 1
fi
main(){
DIR_OR_FILE=$1
shift
CMD="$@"
fswatch -or ${DIR_OR_FILE} | xargs -n1 -I{} -- ${CMD}
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment