From d8c6d40dd9ae1bea149c5c103a41c9fecf7ef8f9 Mon Sep 17 00:00:00 2001 From: redxef Date: Thu, 8 Jun 2023 01:13:26 +0200 Subject: [PATCH] Shift by OPTIND-1 after parsing, instead of during. --- tarback.sh | 3 ++- tarback/ssh.sh | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tarback.sh b/tarback.sh index 56780e9..b187d0a 100755 --- a/tarback.sh +++ b/tarback.sh @@ -125,7 +125,6 @@ while getopts "$short_options" arg; do exit 1 fi done - shift 2 ;; *) echo "unknown option $1" >&2 @@ -134,6 +133,8 @@ while getopts "$short_options" arg; do esac done +shift $((OPTIND-1)) + case "$1" in create) shift diff --git a/tarback/ssh.sh b/tarback/ssh.sh index 3326ee1..f70a5fd 100644 --- a/tarback/ssh.sh +++ b/tarback/ssh.sh @@ -23,7 +23,6 @@ while getopts "$short_options" arg; do case "$arg" in s) TARBACK_REMOTE="$OPTARG" - shift 2 ;; *) echo "unknown option $1" >&2