rwxrob-dot/scripts/onchange
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

20 lines
378 B
Bash
Executable File

#!/usr/bin/env bash
## Runs the passed command (assuming the first argument is another
## command) anytime anything in the current or any subdirectory
## (recursively) changes for any reason (also see changed).
onchange () {
local dir="${PWD}"
haschanged "${dir}"
local count=$?
if (( $count > 0 ));then
"$@"
fi
}
while true; do
onchange "$@"
sleep .5
done