summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Trautwein <dennis.trautwein@posteo.de>2023-12-09 18:52:09 +0100
committerGitHub <noreply@github.com>2023-12-09 17:52:09 +0000
commitbdd7fe661f5157dd30bb0dd07006bfa97555b8f6 (patch)
tree61308378dcad9c008ed5e34a50c9dc87adde6b29
parentde6221942ad8b1a6ce2a81aaf878e37a48ccb0ab (diff)
fix: respect ZSH's $ZDOTDIR environment variable (#942)
ZSH reads its configuration by default relative to a path that's set via $ZDOTDIR. If $ZDOTDIR is not set, then the value of $HOME is used; this is the usual case. Source: https://zsh.sourceforge.io/Intro/intro_3.html#IDX11 Also $HOME is save to use, because "The system shall initialize this variable at the time of login to be a pathname of the user's home directory". Source: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Lastly, the shell parameter expansion syntax is save to use generically: https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02 Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
-rwxr-xr-xinstall.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/install.sh b/install.sh
index db63d6ca..f547a7cd 100755
--- a/install.sh
+++ b/install.sh
@@ -184,7 +184,7 @@ esac
# Use of single quotes around $() is intentional here
# shellcheck disable=SC2016
if ! grep -q "atuin init zsh" ~/.zshrc; then
- printf '\neval "$(atuin init zsh)"\n' >> ~/.zshrc
+ printf '\neval "$(atuin init zsh)"\n' >> "${ZDOTDIR:-$HOME}/.zshrc"
fi
# Use of single quotes around $() is intentional here