From 53335ee4ef84a84216c05783e44296771c6f1aaf Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Thu, 29 Nov 2018 18:42:20 +0100 Subject: [PATCH] Apply first and third benpro review of web-add fix command Simplify sed(1) command by getting rid of echo(1) Use a2ensite(1) instead of ln(1) to link vhosts. --- scripts/web-add.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/web-add.sh b/scripts/web-add.sh index eae492d..e0022dc 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -997,7 +997,7 @@ op_add() { # Some people forget to use the --follow-symlinks flag with sed(1), # thus not carrying changes over to /etc/sites-available. op_fixvhosts() { - ln_vhosts_dir="$(echo "$VHOST_PATH" | sed 's/available/enabled')" + ln_vhosts_dir="$(sed 's/available/enabled/' <<< "$VHOST_PATH")" non_ln_vhosts="$(find "$ln_vhosts_dir"/* ! -type l)" for ln_path in $non_ln_vhosts @@ -1005,7 +1005,7 @@ op_fixvhosts() { vhost_name=$(basename "$ln_path") mv "$ln_path" "$VHOST_PATH/$vhost_name" - ln -s "$VHOST_PATH/$vhost_name" "$ln_path" + a2ensite "$vhostname" done }