From a4300807259390fa74dbffab21a4d2475a9eb399 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 30 Nov 2026 17:12:57 +0100 Subject: [PATCH] exec-watch --- scripts/exec-watch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/exec-watch diff --git a/scripts/exec-watch b/scripts/exec-watch new file mode 100755 index 0000000..89eea75 --- /dev/null +++ b/scripts/exec-watch @@ -0,0 +1,20 @@ +#!/bin/bash + +set -euo pipefail + +script_name=${0##*/} + +if (( $# == 0 )); then + echo "Usage: $script_name command [args ...]" >&2 + exit 2 +fi + +if ! command -v inotifywait >/dev/null; then + echo "$script_name: inotifywait was not found. Install inotify-tools." >&2 + exit 127 +fi + +while true; do + ("$@") || echo "$script_name: command exited with status $?" >&2 + inotifywait --quiet --recursive --event close_write,move,create,delete . >/dev/null +done