Manually select the last argument.
This implementation does not rely on Bash-specific functionality.
diff --git a/git-flow-feature b/git-flow-feature
index a413534..8893598 100644
--- a/git-flow-feature
+++ b/git-flow-feature
@@ -180,7 +180,7 @@
parse_cmdline "$@"
# read arguments into global variables
- NAME=${!#}
+ NAME=$(last_arg "$@")
BRANCH=$PREFIX$NAME
}
diff --git a/git-flow-hotfix b/git-flow-hotfix
index 436760c..a675619 100644
--- a/git-flow-hotfix
+++ b/git-flow-hotfix
@@ -124,7 +124,7 @@
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
- VERSION=${!#}
+ VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}
diff --git a/git-flow-release b/git-flow-release
index e24c55e..aea6e42 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -121,7 +121,7 @@
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
- VERSION=${!#}
+ VERSION=$(last_arg "$@")
BRANCH=$PREFIX$VERSION
}
diff --git a/gitflow-common b/gitflow-common
index dcb58bd..e5ffc74 100644
--- a/gitflow-common
+++ b/gitflow-common
@@ -44,6 +44,14 @@
warn() { echo "$@" >&2; }
die() { warn "$@"; exit 1; }
+# argument processing
+last_arg() {
+ if [ $# -ne 0 ]; then
+ shift $(expr $# - 1)
+ echo "$1"
+ fi
+}
+
# set logic
has() {
local item=$1; shift