Skip to content

Commit

Permalink
site_unlink/project_remove: Only clear full match
Browse files Browse the repository at this point in the history
`sed` has previously also removed lines that have only partly matched. Now, only full matches are removed.
  • Loading branch information
lukasbestle committed Jun 1, 2020
1 parent 723dba4 commit 807c88a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/project_remove
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/site_unlink
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 807c88a

Please sign in to comment.