Use ZDOTDIR env variable for path to .zshrc
.zshrc can be found at "~/.zshrc", when ZDOTDIR is not set.
If ZDOTDIR is set, .zshrc is in "${ZDOTDIR}/.zshrc".
Using parameter expansion, the hardcoded path can be replaced with
"${ZDOTDIR:-$HOME}/.zshrc". That way, it'll use the value in
ZDOTDIR when set and the value in HOME when not.
This thus mirrors the usage of ZDOTDIR in zsh and makes the code
more fexible.
This commit is contained in:
15
uninstall.sh
15
uninstall.sh
@@ -7,9 +7,12 @@ if [[ $OSTYPE == "Darwin" ]]; then
|
||||
sed="sed -i ''"
|
||||
fi
|
||||
|
||||
for rc in bashrc zshrc; do
|
||||
if [ -f "$HOME/.$rc" ]; then
|
||||
$sed '/scm_breeze/d' "$HOME/.$rc" &&
|
||||
printf "Removed SCM Breeze from %s\n" "$HOME/.$rc"
|
||||
fi
|
||||
done
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
$sed '/scm_breeze/d' "$HOME/.bashrc" &&
|
||||
printf "Removed SCM Breeze from '%s'\n" "$HOME/.bashrc"
|
||||
fi
|
||||
|
||||
if [ -f "${ZDOTDIR:-$HOME}/.zshrc" ]; then
|
||||
$sed '/scm_breeze/d' "${ZDOTDIR:-$HOME}/.zshrc" &&
|
||||
printf "Removed SCM Breeze from '%s'\n" "${ZDOTDIR:-$HOME}/.zshrc"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user