More config cleanup
Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
parent
005c4f29b6
commit
8d3f9c8a1d
22 changed files with 44 additions and 27 deletions
30
system/.local/bin/watch.sh
Executable file
30
system/.local/bin/watch.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# SCRIPT NAME:
|
||||
# watch.sh
|
||||
#
|
||||
# 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.sh FILE COMMAND...
|
||||
. utils.sh
|
||||
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue