mirror of https://github.com/rwxrob/dot
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
378 B
Plaintext
20 lines
378 B
Plaintext
3 years ago
|
#!/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
|