diff --git a/scripts/exec-watch b/scripts/exec-watch index 89eea75..0e72bd1 100755 --- a/scripts/exec-watch +++ b/scripts/exec-watch @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh set -euo pipefail -script_name=${0##*/} +script_name=$(basename "$0") -if (( $# == 0 )); then +if [ "$#" -eq 0 ]; then echo "Usage: $script_name command [args ...]" >&2 exit 2 fi @@ -15,6 +15,6 @@ if ! command -v inotifywait >/dev/null; then fi while true; do - ("$@") || echo "$script_name: command exited with status $?" >&2 + ( "$@" ) || echo "$script_name: command exited with status $?" >&2 inotifywait --quiet --recursive --event close_write,move,create,delete . >/dev/null done