From df301bda3a0b127db43a80192532e274779e26a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?X=C3=A9fir=20Destiny?= Date: Mon, 10 Oct 2016 16:26:24 +0200 Subject: [PATCH] missing quotes and fix cat no such file or directory --- commands/exim_forwardadd.sh | 2 +- commands/exim_forwarddel.sh | 2 +- commands/exim_forwardlist.sh | 2 +- commands/exim_userdel.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/exim_forwardadd.sh b/commands/exim_forwardadd.sh index 597ad93..a5f7d0e 100644 --- a/commands/exim_forwardadd.sh +++ b/commands/exim_forwardadd.sh @@ -6,4 +6,4 @@ echo "Forward TO email: " read emailto DIR=/etc/exim4/forward -echo "$(cat $DIR/$emailfrom)$emailto," > "$DIR/$emailfrom" +echo "$([[ -f $DIR/$emailfrom ]] && cat $DIR/$emailfrom)$emailto," > "$DIR/$emailfrom" diff --git a/commands/exim_forwarddel.sh b/commands/exim_forwarddel.sh index dc9f1eb..b3448bc 100644 --- a/commands/exim_forwarddel.sh +++ b/commands/exim_forwarddel.sh @@ -7,4 +7,4 @@ read emailto DIR=/etc/exim4/forward sed -i "s/$emailto,//g" "$DIR/$emailfrom" -[[ ! -s $DIR/$emailfrom ]] && rm -f $DIR/$emailfrom +[[ ! -s "$DIR/$emailfrom" ]] && rm -f "$DIR/$emailfrom" diff --git a/commands/exim_forwardlist.sh b/commands/exim_forwardlist.sh index c45bb0b..cc319df 100644 --- a/commands/exim_forwardlist.sh +++ b/commands/exim_forwardlist.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash DIR=/etc/exim4/forward -for file in $DIR/* +for file in "$DIR/*" do echo "$file: $(cat $DIR/$file)" done diff --git a/commands/exim_userdel.sh b/commands/exim_userdel.sh index 567d132..2eb7160 100644 --- a/commands/exim_userdel.sh +++ b/commands/exim_userdel.sh @@ -7,6 +7,6 @@ read domain DIR=/etc/exim4/domains sed -i "/$username/d" "$DIR/$domain" -[[ ! -s $DIR/$domain ]] && rm -f $DIR/$domain +[[ ! -s "$DIR/$domain" ]] && rm -f "$DIR/$domain" userdb "$username@$domain" del makeuserdb