16 lines
284 B
Shell
Executable file
16 lines
284 B
Shell
Executable file
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -lt 2 ]; then
|
|
>&2 echo "usage: $0 dir command [args]"
|
|
exit 1
|
|
fi
|
|
|
|
dir="$1"; shift
|
|
cmd=("$@")
|
|
|
|
# I specifically want the command to expand here.
|
|
#
|
|
# shellcheck disable=SC2068
|
|
until fd . "${dir}" | entr -dr ${cmd[@]}; do :; done
|