From 101e4fe00c752f972338c99d97d8a2a2b5e84c35 Mon Sep 17 00:00:00 2001 From: bretello Date: Sun, 28 Jul 2024 14:36:31 +0200 Subject: [PATCH] zsh: watch_file: exit when input file does not exist --- functions/misc.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/misc.zsh b/functions/misc.zsh index 32b711a..aeb6001 100755 --- a/functions/misc.zsh +++ b/functions/misc.zsh @@ -316,6 +316,10 @@ function watch_file() { { set +m # disable job control messages while true; do + if [[ ! -f "$file" ]]; then + echo "File \"$file\" does not exist"; + break + fi zsh -c "$action" & _bg_job_pid=$! disown