From 9e36977b9d4641c9fc67eee9b36bdfa8a3b85bbd Mon Sep 17 00:00:00 2001 From: memdmp Date: Wed, 22 Jan 2025 16:43:55 +0100 Subject: fix: avoid grepping shell rc file, and avoid calling __sethist if not defined --- zuwu.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zuwu.zsh b/zuwu.zsh index 00f788f..afa26fb 100755 --- a/zuwu.zsh +++ b/zuwu.zsh @@ -19,9 +19,8 @@ eval_append() { <<<"$2" >> "$1" eval "$2" } -if ! grep '# The following lines were added by compinstall' ~/.zshrc >/dev/null 2>/dev/null && ! grep 'compinit' ~/.zshrc >/dev/null 2>/dev/null; then +if ! test compinit >/dev/null 2>/dev/null; then eval_append ~/.zshrc "$(</dev/null 2>/dev/null; then +if ! [ -n "${HISTSIZE+1}" ]; then eval_append ~/.zshrc "$(</dev/null 2>/dev/null && __sethist || true EOF )" fi -- cgit v1.2.3