Created
April 25, 2023 08:37
-
-
Save pasdam/57fe4cdb3a28da591963c0baad31bc7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH_TO_WATCH=$1 | |
COMMAND=$2 | |
trap printout SIGINT | |
printout() { | |
echo "" | |
1>&2 echo "Watch path terminated forcefully" | |
exit | |
} | |
while true | |
do | |
watch -d -t -g ls -lR ${PATH_TO_WATCH} > /dev/null && RES=$? && eval "${COMMAND}" | |
printf "\n\n\n-------------------\n\n\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment