From bc6e29c3fb884963b8f14f9652f7494510eeb034 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 9 Apr 2024 10:47:13 +0400 Subject: [PATCH] Shorter sourced() code --- run.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/run.sh b/run.sh index 388bfa7..8147ab3 100755 --- a/run.sh +++ b/run.sh @@ -64,15 +64,8 @@ main () { } sourced () { - if [ -n "$ZSH_VERSION" ] - then - case $ZSH_EVAL_CONTEXT in - *:file*) return 0;; - esac - elif [ -n "$BASH_VERSION" ] - then - ! [ "$0" = "$BASH_SOURCE" ] && return 0 - fi + [ -n "$ZSH_VERSION" ] && [[ "$ZSH_EVAL_CONTEXT" =~ :file ]] && return 0 + [ -n "$BASH_VERSION" ] && ! [ "$0" = "$BASH_SOURCE" ] && return 0 return 1 }