aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-06-09 18:39:08 +0100
committerGravatar Joe Banks <[email protected]>2024-06-09 18:39:08 +0100
commita423a9d08a2c365cc3371c576987aa6c3f84b9df (patch)
treee62f65f756179c6b50ac601603d8e7ec3c4a23ea
parentAllow for manually setting which inotify events to wait for (diff)
Set additional args correctly to factor in bash scoping
-rwxr-xr-xmonitor.sh9
1 files changed, 1 insertions, 8 deletions
diff --git a/monitor.sh b/monitor.sh
index 9af6f19..a89d64e 100755
--- a/monitor.sh
+++ b/monitor.sh
@@ -15,14 +15,7 @@ else
fi;
fi;
-ADDITIONAL_ARGS=""
-
-if [ -z ${WATCH_EVENTS+x} ]; then
- echo "Found watch events"
- ADDITIONAL_ARGS="-e $WATCH_EVENTS"
-fi;
-
-echo "Final command: inotifywait $ADDITIONAL_ARGS -r /opt/monitor"
+ADDITIONAL_ARGS=$(if [[ -n "$WATCH_EVENTS" ]]; then echo "-e $WATCH_EVENTS"; else echo ""; fi)
while inotifywait $ADDITIONAL_ARGS -r /opt/monitor; do
$HOOK_SCRIPT