From ddb763e06b51a2bc4af8740166825e97951ac83c Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 9 Apr 2024 11:29:50 +0400 Subject: [PATCH] Shorten `if`s again --- run.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index 8374f4d..526dd6a 100755 --- a/run.sh +++ b/run.sh @@ -32,11 +32,7 @@ runcmd () { } main () { - if [[ "$1" == "--help" ]] || [[ "$1" == "" ]] - then - help - exit 0 - fi + [[ "$1" == "--help" || "$1" == "" ]] && help && exit 0 chrdir=$(readlink -f "$1") chrcmd="${2:-/bin/bash}" @@ -50,7 +46,7 @@ main () { sourced () { [ -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 }