]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Improve basename()
authorRichard Hartmann <richih.mailinglist@gmail.com>
Mon, 6 May 2013 20:07:44 +0000 (22:07 +0200)
committerRichard Hartmann <richih.mailinglist@gmail.com>
Mon, 6 May 2013 20:07:44 +0000 (22:07 +0200)
vcsh

diff --git a/vcsh b/vcsh
index fb99ffb46b953e9fec026c3286c98a3b8bff6e94..d742cf44cae8c27aeeaa1c796954e0b26bb1a437 100755 (executable)
--- a/vcsh
+++ b/vcsh
 # this software will most likely follow suit.
 
 basename() {
 # this software will most likely follow suit.
 
 basename() {
-       local f; f="${1##*/}"
-       [ -z "$2" ] || f="${f%$2}"
-       echo "$f"
+       # Implemented in shell to avoid spawning another process
+       local file
+       file="${1##*/}"
+       [ -z "$2" ] || file="${file%$2}"
+       echo "$file"
 }
 
 SELF=$(basename $0)
 }
 
 SELF=$(basename $0)