Skip to contentSkip to conversation

git-sh-setup.sh: use dashdash with basename call

PATCH New Dan Wyand 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Dan Wyand

author
#0 lore raw

PATCH 1/1 git-sh-setup.sh: use dashdash with basename call

Calling basename on a argument that starts with a dash, like a login shell, will result in an error. This patch adds '--' before the argument so that the argument is interpreted properly.

---
 git-sh-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git-sh-setup.sh +1 -1
index 9447980..5cdae33 100644
@@ -81,7 +81,7 @@ if test -n "$OPTIONS_SPEC"; then
 		echo exit $?
 	)"
 else
-	dashless=$(basename "$0" | sed -e 's/-/ /')
+	dashless=$(basename -- "$0" | sed -e 's/-/ /')
 	usage() {
 		die "usage: $dashless $USAGE"
 	}
Signature · 1 line
2.1.3