From 3cda18fef6718f5f7351e65f116968a387912a7b Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 25 Jul 2024 18:00:33 -0400 Subject: [PATCH] fixup --- src/sum.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/sum.sh b/src/sum.sh index ecb7322..aad2702 100644 --- a/src/sum.sh +++ b/src/sum.sh @@ -1,18 +1,9 @@ # /etc/profile.d/sum.sh # Ensure the script is sourced, not executed -if [ -n "$ZSH_VERSION" ]; then - # For zsh - if [[ "${(%):-%x}" == "$0" ]]; then - echo "This script should be sourced, not executed." - return 1 - fi -else - # For bash - if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - echo "This script should be sourced, not executed." - return 1 - fi +if [[ "$0" == "${BASH_SOURCE[0]}" ]] || [[ "$0" == "${(%):-%x}" ]]; then + echo "This script should be sourced, not executed." + return 1 2>/dev/null || exit 1 fi # Function to generate SHA-256 hashes for .sh files in a given directory