missing quotes and fix cat no such file or directory

This commit is contained in:
Michel Roux 2016-10-10 16:26:24 +02:00 committed by Michel Roux
parent f220f20894
commit df301bda3a
4 changed files with 4 additions and 4 deletions

View File

@ -6,4 +6,4 @@ echo "Forward TO email: "
read emailto read emailto
DIR=/etc/exim4/forward DIR=/etc/exim4/forward
echo "$(cat $DIR/$emailfrom)$emailto," > "$DIR/$emailfrom" echo "$([[ -f $DIR/$emailfrom ]] && cat $DIR/$emailfrom)$emailto," > "$DIR/$emailfrom"

View File

@ -7,4 +7,4 @@ read emailto
DIR=/etc/exim4/forward DIR=/etc/exim4/forward
sed -i "s/$emailto,//g" "$DIR/$emailfrom" sed -i "s/$emailto,//g" "$DIR/$emailfrom"
[[ ! -s $DIR/$emailfrom ]] && rm -f $DIR/$emailfrom [[ ! -s "$DIR/$emailfrom" ]] && rm -f "$DIR/$emailfrom"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR=/etc/exim4/forward DIR=/etc/exim4/forward
for file in $DIR/* for file in "$DIR/*"
do do
echo "$file: $(cat $DIR/$file)" echo "$file: $(cat $DIR/$file)"
done done

View File

@ -7,6 +7,6 @@ read domain
DIR=/etc/exim4/domains DIR=/etc/exim4/domains
sed -i "/$username/d" "$DIR/$domain" sed -i "/$username/d" "$DIR/$domain"
[[ ! -s $DIR/$domain ]] && rm -f $DIR/$domain [[ ! -s "$DIR/$domain" ]] && rm -f "$DIR/$domain"
userdb "$username@$domain" del userdb "$username@$domain" del
makeuserdb makeuserdb