From 70cb5967b2046c1593efba8d42f87499525c7670 Mon Sep 17 00:00:00 2001 From: Colin Ng Date: Wed, 1 Jan 2025 06:38:03 -0800 Subject: [PATCH] Claude: The issue is in the zsh detection code. In zsh, $0 doesn't work the same way as bash for detecting if a script is sourced. Let's patch it to fix zsh sourcing detection. --- ok.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ok.sh b/ok.sh index 0217c13..44c4288 100755 --- a/ok.sh +++ b/ok.sh @@ -280,8 +280,9 @@ environment variables (for internal use): } is_sourced="" -if [ "${ZSH_ARGZERO:+IS_SET}" = "IS_SET" ]; then - if [ "$ZSH_ARGZERO" = "zsh" ]; then +if [ -n "$ZSH_VERSION" ]; then + # For zsh, check if script name matches $0 + if [[ "${(%):-%N}" == *"ok.sh" ]]; then is_sourced="yes_indeed" fi else