From 3babe7cebce8644dccd2641b9ac22801507422e3 Mon Sep 17 00:00:00 2001 From: Pelle Jacobs Date: Sun, 21 Aug 2016 13:03:49 +0200 Subject: [PATCH] Create fswatch.md (#1005) * Create fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md * Update fswatch.md --- pages/common/fswatch.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pages/common/fswatch.md diff --git a/pages/common/fswatch.md b/pages/common/fswatch.md new file mode 100644 index 000000000..0a39e736d --- /dev/null +++ b/pages/common/fswatch.md @@ -0,0 +1,19 @@ +# fswatch + +> A cross-platform file change monitor. + +- Run a bash command on file creation, update or deletion: + +`fswatch -0 {{path/to/file}} | xargs -0 {{bash_command}}` + +- Watch one or more files and/or directories: + +`fswatch -0 {{path/to/file}} {{path/to/directory}} {{path/to/another_directory/**/*.js}} | xargs -0 {{bash_command}}` + +- Use `{}` in your bash command as a placeholder for the absolute path to the changed file: + +`fswatch -0 {{path/to/directory}} | xargs -0 -I {} {{bash_command}}` + +- Filter by event type, eg. Updated, Deleted or Created: + +`fswatch -0 --event {{Updated}} {{path/to/directory}} | xargs -0 {{bash_command}}`