commit 3f10474a8afe4de07faf3ec3664e43e0e38edff5
parent 2ecce99435044017e698ac4411f75d40e55eb8ab
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date: Mon, 4 Sep 2023 11:56:54 +0200
watcher: now checks if required programs are found
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/watcher b/watcher
@@ -6,7 +6,21 @@ kill_viewer()
exit
}
-which inotifywait || exit
+die()
+{
+ echo $@
+ exit 1
+}
+
+requires()
+{
+ which "$1" > /dev/null || die "$1 could not be found"
+}
+
+requires xdotool
+requires dot
+requires inotifywait
+
exec 0<&-
SOURCE="${1:?"SOURCE required as 1st arg"}"
VIEWER="${2:?"VIEWER required as 2nd arg"}"