From cca85a25db935ad93dd2794287c42448d82757e0 Mon Sep 17 00:00:00 2001 From: Luca Di Maio Date: Sun, 19 Nov 2023 12:43:41 +0100 Subject: [PATCH] assemble: fix empty args in hooks handling Signed-off-by: Luca Di Maio --- distrobox-assemble | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/distrobox-assemble b/distrobox-assemble index 50804ee00b..e7cbf97685 100755 --- a/distrobox-assemble +++ b/distrobox-assemble @@ -290,6 +290,10 @@ run_distrobox() ( args=": ;" separator="" for arg in ${init_hooks}; do + if [ -z "${arg}" ]; then + continue + fi + args="${args} ${separator} ${arg}" # Prepare for the next line, if we already have a ';' or '&&', do nothing @@ -309,12 +313,16 @@ run_distrobox() ( args=": ;" separator="" for arg in ${pre_init_hooks}; do + if [ -z "${arg}" ]; then + continue + fi + args="${args} ${separator} ${arg}" # Prepare for the next line, if we already have a ';' or '&&', do nothing # else prefer adding '&&' - if ! echo "${arg}" | grep -q ';[[:space:]]\{0,1\}$' && - ! echo "${arg}" | grep -q '&&[[:space:]]\{0,1\}$'; then + if ! echo "${arg}" | grep -E ';[[:space:]]\{0,1\}$' && + ! echo "${arg}" | grep -E '&&[[:space:]]\{0,1\}$'; then separator="&&" else separator=""