Replace sed with array parsing to properly handle multiple paths with spaces

This commit is contained in:
Piotr Maj
2023-11-05 18:58:02 +01:00
parent 71430df23d
commit 4b702eb59a
@@ -1,9 +1,9 @@
#!/usr/bin/with-contenv bash
if [ -n "${LOGS_TO_STDOUT}" ]; then
TAIL_LOGS=$(echo "$LOGS_TO_STDOUT" | sed 's#|# #g')
echo "Executing: tail -F $TAIL_LOGS"
tail -F "$TAIL_LOGS"
IFS='|' read -ra PATH_ARRAY <<< "$LOGS_TO_STDOUT"
echo "Executing: tail -F ${PATH_ARRAY[@]}"
tail -F "${PATH_ARRAY[@]}"
else
echo "**** Env var LOGS_TO_STDOUT is not set, sleeping ****"
fi