From 3a49c9c11fdf642d198c7a05968027a42f2eaaa8 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 10 Dec 2023 09:14:12 -0800 Subject: [PATCH] Make hishtory work with set -o nounset for bash and zsh, for #142 (#144) --- client/lib/config.sh | 4 ++-- client/lib/config.zsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/lib/config.sh b/client/lib/config.sh index 8791c8c..289f9eb 100644 --- a/client/lib/config.sh +++ b/client/lib/config.sh @@ -7,7 +7,7 @@ __hishtory_bash_config_sourced=`date` # Implementation of running before/after every command based on https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/ function __hishtory_precommand() { - if [ -z "$HISHTORY_AT_PROMPT" ]; then + if [ -z "${HISHTORY_AT_PROMPT:-}" ]; then return fi unset HISHTORY_AT_PROMPT @@ -27,7 +27,7 @@ function __hishtory_postcommand() { EXIT_CODE=$? HISHTORY_AT_PROMPT=1 - if [ -n "$HISHTORY_FIRST_PROMPT" ]; then + if [ -n "${HISHTORY_FIRST_PROMPT:-}" ]; then unset HISHTORY_FIRST_PROMPT return fi diff --git a/client/lib/config.zsh b/client/lib/config.zsh index f919d01..37eb0b6 100644 --- a/client/lib/config.zsh +++ b/client/lib/config.zsh @@ -19,7 +19,7 @@ function _hishtory_precmd() { # Runs after the command is executed in order to render the prompt # $? contains the exit code _hishtory_exit_code=$? - if [ -n "$_hishtory_first_prompt" ]; then + if [ -n "${_hishtory_first_prompt:-}" ]; then unset _hishtory_first_prompt return fi