dotfiles/system/.local/bin/watch-file
Severin Kaderli 61012463fe
Clean up scripts
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
2022-05-11 20:59:42 +02:00

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