From 1306924c9145519dc17225fbdc6f7e27162ff969 Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Sun, 24 Oct 2021 22:47:22 -0400 Subject: [PATCH] improve adding arguments to ARGS array --- template.sh | 7 ++++++- template_standalone.sh | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/template.sh b/template.sh index c709443..d5d8637 100755 --- a/template.sh +++ b/template.sh @@ -207,7 +207,12 @@ _parseOptions_() { esac shift done - ARGS+=("$@") # Store the remaining user input as arguments. + + if [[ -z ${*} || ${*} == null ]]; then + ARGS=() + else + ARGS+=("$@") # Store the remaining user input as arguments. + fi } _usage_() { diff --git a/template_standalone.sh b/template_standalone.sh index cba9d6d..884f002 100755 --- a/template_standalone.sh +++ b/template_standalone.sh @@ -516,7 +516,12 @@ _parseOptions_() { esac shift done - ARGS+=("$@") # Store the remaining user input as arguments. + + if [[ -z ${*} || ${*} == null ]]; then + ARGS=() + else + ARGS+=("$@") # Store the remaining user input as arguments. + fi } _usage_() {