From bdd7fe661f5157dd30bb0dd07006bfa97555b8f6 Mon Sep 17 00:00:00 2001 From: Dennis Trautwein Date: Sat, 9 Dec 2023 18:52:09 +0100 Subject: [PATCH] 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 --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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