whenfilechanges with glob support
This commit is contained in:
@@ -137,8 +137,6 @@ Keeps a history of folders visited in ~/.bash_cdhistory
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function whenfilechanges() {
|
function whenfilechanges() {
|
||||||
[ -z "$2" ] && { echo 'Usage: whenfilechanges "file" "some" "command"
|
[ -z "$2" ] && { echo 'Usage: whenfilechanges "file" "some" "command"
|
||||||
Follows the modification time of the "file" and runs the command
|
Follows the modification time of the "file" and runs the command
|
||||||
@@ -172,6 +170,7 @@ function whenfilechanges() {
|
|||||||
echo "${fname[$i]} changed:"
|
echo "${fname[$i]} changed:"
|
||||||
eval "$@"
|
eval "$@"
|
||||||
otime[$i]=$( stat -c %Z "${fname[$i]}" )
|
otime[$i]=$( stat -c %Z "${fname[$i]}" )
|
||||||
|
echo "Waiting for file changes..."
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
Reference in New Issue
Block a user