mirror of
https://github.com/rwxrob/dot
synced 2024-11-18 15:25:52 +00:00
20 lines
506 B
Plaintext
20 lines
506 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
## Returns the full path to any changed files in the current directory
|
||
|
## or any subdirectories recursively one to a line. Useful for detecting
|
||
|
## changes and taking action (see onchange).
|
||
|
|
||
|
changed () {
|
||
|
local dir="${PWD}"
|
||
|
local tmpname="onchange${dir//\//-}"
|
||
|
local tmp="/tmp/${tmpname}"
|
||
|
if [[ ! -e "${tmp}" ]]; then
|
||
|
find "${dir}" -type f -not -path '*testdata*'
|
||
|
else
|
||
|
find "${dir}" -newer "${tmp}" -type f -not -path '*testdata*'
|
||
|
fi
|
||
|
touch "${tmp}"
|
||
|
}
|
||
|
|
||
|
changed "$@"
|