Shorten ifs again

This commit is contained in:
DarkCat09 2024-04-09 11:29:50 +04:00
parent cc5b00f0d0
commit ddb763e06b
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

8
run.sh
View file

@ -32,11 +32,7 @@ runcmd () {
} }
main () { main () {
if [[ "$1" == "--help" ]] || [[ "$1" == "" ]] [[ "$1" == "--help" || "$1" == "" ]] && help && exit 0
then
help
exit 0
fi
chrdir=$(readlink -f "$1") chrdir=$(readlink -f "$1")
chrcmd="${2:-/bin/bash}" chrcmd="${2:-/bin/bash}"
@ -50,7 +46,7 @@ main () {
sourced () { sourced () {
[ -n "$ZSH_VERSION" ] && [[ "$ZSH_EVAL_CONTEXT" =~ :file ]] && return 0 [ -n "$ZSH_VERSION" ] && [[ "$ZSH_EVAL_CONTEXT" =~ :file ]] && return 0
[ -n "$BASH_VERSION" ] && ! [ "$0" = "$BASH_SOURCE" ] && return 0 [ -n "$BASH_VERSION" ] && [[ "$0" != "$BASH_SOURCE" ]] && return 0
return 1 return 1
} }