From 7fecbc9343fffbeda0829e28df28ced082986d83 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 21 Aug 2023 23:16:45 +0100 Subject: [PATCH] feat(scripts): add `watch-changes` Based on https://github.com/sdaschner/dotfiles/blob/2d235c4c7161bd5f4d0d3d5f78f87bbd3bd0350d/bin/watch-changes. --- bin/watch-changes | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/watch-changes diff --git a/bin/watch-changes b/bin/watch-changes new file mode 100755 index 0000000..ad8cb2e --- /dev/null +++ b/bin/watch-changes @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +if [[ "$1" == "" || "$2" == "" ]]; then + echo "usage: ${0##*/} "; + exit 2; +fi + +set -euo pipefail + +while true; do + inotifywait \ + --event modify \ + --event move_self \ + --recursive \ + $1 && $2 +done