mirror of
https://github.com/lukasbestle/projectr.git
synced 2026-10-11 23:10:19 +02:00
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.
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ fi
|
|||||||
# Remove from the projects file
|
# Remove from the projects file
|
||||||
echo -e "\033[1mRemoving project from \033[34m$projectsFile\033[0;1m...\033[0m"
|
echo -e "\033[1mRemoving project from \033[34m$projectsFile\033[0;1m...\033[0m"
|
||||||
realpath="$(readlink -f "$project")"
|
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
|
echo -e " => \033[31mSomething went wrong.\033[0m" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ echo -e " => \033[32mSuccess.\033[0m"
|
|||||||
|
|
||||||
# Remove from site's domains
|
# Remove from site's domains
|
||||||
echo -e "\033[1mRemoving domain from site's domains (\033[34m.domains\033[0;1m file)...\033[0m"
|
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
|
if [[ $? == 0 ]]; then
|
||||||
echo -e " => \033[32mSuccess.\033[0m"
|
echo -e " => \033[32mSuccess.\033[0m"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user