Rename scripts

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2019-03-06 16:53:16 +01:00
parent df6b44e541
commit 410d0b33c6
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
46 changed files with 566 additions and 249 deletions

30
system/.local/bin/watch-file Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# watch-file
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script watches a file for changes and if it changes it
# executes the given command.
#
# USAGE:
# ./watch-file FILE COMMAND...
. 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