git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Wyand <danwyand@gmail.com>
To: git@vger.kernel.org
Cc: Dan Wyand <danwyand@gmail.com>
Subject: [PATCH] git-sh-setup.sh: use dashdash with basename call
Date: Mon, 24 Nov 2014 18:03:31 -0500	[thread overview]
Message-ID: <1416870211-13959-1-git-send-email-danwyand@gmail.com> (raw)

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(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 9447980..5cdae33 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -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"
 	}
-- 
2.1.3

             reply	other threads:[~2014-11-24 23:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 23:03 Dan Wyand [this message]
2014-11-25  0:28 ` [PATCH] git-sh-setup.sh: use dashdash with basename call Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2014-11-24 23:20 Dan Wyand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416870211-13959-1-git-send-email-danwyand@gmail.com \
    --to=danwyand@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).