Shorter sourced() code

This commit is contained in:
DarkCat09 2024-04-09 10:47:13 +04:00
parent 350ef0cb51
commit bc6e29c3fb
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

11
run.sh
View file

@ -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
}