18 lines
322 B
Bash
Executable file
18 lines
322 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
. utils
|
|
|
|
# The file to watch
|
|
FILE="${1}"
|
|
FILENAME=$(basename "${FILE}")
|
|
|
|
# The rest of the arguments is the command
|
|
shift
|
|
COMMAND="${*}"
|
|
|
|
print_section "Watching ${FILE}"
|
|
while inotifywait -qq -e close_write "${FILE}";
|
|
do
|
|
print_notify "${FILENAME} has changed" "Executing command"
|
|
$COMMAND
|
|
done
|