From 4c3bca05e598aeaf798654e7cb5ed4fa79661b20 Mon Sep 17 00:00:00 2001 From: Jon Date: Wed, 12 Oct 2016 22:51:53 -0400 Subject: [PATCH] Fix for no arguments causing error (#119) --- plexupdate.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index 5027f5f..f760544 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -156,11 +156,13 @@ trimQuotes() { echo $__buffer } -HASCFG="${@: -1}" -if [ ! -z "${HASCFG}" -a ! "${HASCFG:0:1}" = "-" -a ! "${@:(-2):1}" = "--config" ]; then - if [ -f "${HASCFG}" ]; then - echo "WARNING: Specifying config file as last argument is deprecated. Use --config instead." - CONFIGFILE=${HASCFG} +if [ ! $# -eq 0 ]; then + HASCFG="${@: -1}" + if [ ! -z "${HASCFG}" -a ! "${HASCFG:0:1}" = "-" -a ! "${@:(-2):1}" = "--config" ]; then + if [ -f "${HASCFG}" ]; then + echo "WARNING: Specifying config file as last argument is deprecated. Use --config instead." + CONFIGFILE=${HASCFG} + fi fi fi