site_unlink/project_remove: Only clear full match

`sed` has previously also removed lines that have only partly matched. Now, only full matches are removed.
master 2.1.0
Lukas Bestle 4 years ago
parent 723dba43fe
commit 807c88af55

@ -43,7 +43,7 @@ fi
# Remove from the projects file
echo -e "\033[1mRemoving project from \033[34m$projectsFile\033[0;1m...\033[0m"
realpath="$(readlink -f "$project")"
if ! sed -i "/${realpath//\//\/}/d" "$projectsFile"; then # Replace / with \/ because of the sed separators
if ! sed -i "/^${realpath//\//\/}$/d" "$projectsFile"; then # Replace / with \/ because of the sed separators
echo -e " => \033[31mSomething went wrong.\033[0m" >&2
exit 1
fi

@ -73,7 +73,7 @@ echo -e " => \033[32mSuccess.\033[0m"
# Remove from site's domains
echo -e "\033[1mRemoving domain from site's domains (\033[34m.domains\033[0;1m file)...\033[0m"
sed -i "/${domain//\//\/}/d" "$HOME/web/sites/$site/.domains" # Replace / with \/ because of the sed separators
sed -i "/^${domain//\//\/}$/d" "$HOME/web/sites/$site/.domains" # Replace / with \/ because of the sed separators
if [[ $? == 0 ]]; then
echo -e " => \033[32mSuccess.\033[0m"
else

Loading…
Cancel
Save