Skip to content

Commit 807c88a

Browse files
committed
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.
1 parent 723dba4 commit 807c88a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bin/project_remove

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fi
4343
# Remove from the projects file
4444
echo -e "\033[1mRemoving project from \033[34m$projectsFile\033[0;1m...\033[0m"
4545
realpath="$(readlink -f "$project")"
46-
if ! sed -i "/${realpath//\//\/}/d" "$projectsFile"; then # Replace / with \/ because of the sed separators
46+
if ! sed -i "/^${realpath//\//\/}$/d" "$projectsFile"; then # Replace / with \/ because of the sed separators
4747
echo -e " => \033[31mSomething went wrong.\033[0m" >&2
4848
exit 1
4949
fi

bin/site_unlink

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ echo -e " => \033[32mSuccess.\033[0m"
7373

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

0 commit comments

Comments
 (0)