Update utils.sh and watch.sh

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2018-12-20 14:29:06 +01:00
parent 2614e38b24
commit c88cf45884
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
2 changed files with 4 additions and 4 deletions

View file

@ -43,8 +43,8 @@ function print_header() {
# Function to print a info message with the current time and to send # Function to print a info message with the current time and to send
# a notification using notify-send. # a notification using notify-send.
# USAGE: print_log TITLE MESSAGE # USAGE: print_notify TITLE MESSAGE
function print_log() { function print_notify() {
notify-send "${1}" "${2}" notify-send "${1}" "${2}"
echo -e "${YELLOW}[$(date "+%H:%M:%S")] ${1} ${2}${RESET}" echo -e "${YELLOW}[$(date "+%H:%M:%S")] ${1} ${2}${RESET}"
} }

View file

@ -22,9 +22,9 @@ FILENAME=$(basename "${FILE}")
shift shift
COMMAND="${*}" COMMAND="${*}"
print_header "Watching ${FILE}" print_section "Watching ${FILE}"
while inotifywait -qq -e close_write "${FILE}"; while inotifywait -qq -e close_write "${FILE}";
do do
print_log "${FILENAME} has changed" "Executing command" print_notify "${FILENAME} has changed" "Executing command"
$COMMAND $COMMAND
done done