From cbbaa28280c08a93ee9a1d758bf04f92550f2937 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Fri, 7 Apr 2023 18:30:02 -0400 Subject: [PATCH] [F] Fix gradle detection --- scripts/zshrc.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/zshrc.sh b/scripts/zshrc.sh index ec911d0..2aa12e9 100755 --- a/scripts/zshrc.sh +++ b/scripts/zshrc.sh @@ -112,14 +112,16 @@ alias ufw="sudo ufw" alias nginx="sudo nginx" # Gradle with auto environment detection -[[ -z $GRADLE ]] && GRADLE="$(which gradle)" -gradle() { - if [[ -f "./gradlew" ]]; then - ./gradlew "$@" - else - $GRADLE "$@" - fi -} +if command -v 'gradle' &> /dev/null; then + [[ -z $GRADLE ]] && GRADLE="$(which gradle)" + gradle() { + if [[ -f "./gradlew" ]]; then + ./gradlew "$@" + else + $GRADLE "$@" + fi + } +fi # Unix permissions reset (Dangerous! This will make executable files no longer executable) reset-permissions-dangerous() {