From 794f0aac869dda034300211e9be45db123d84377 Mon Sep 17 00:00:00 2001
From: "martin f. krafft" <madduck@madduck.net>
Date: Sun, 28 Apr 2013 08:40:49 +0200
Subject: [PATCH] Implement basename in shell

This is simple enough to warrant a re-implementation to avoid spawning
subprocesses.

Signed-off-by: martin f. krafft <madduck@madduck.net>
---
 vcsh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/vcsh b/vcsh
index b03df7a..c9c706b 100755
--- a/vcsh
+++ b/vcsh
@@ -12,6 +12,12 @@
 # which is admittedly extremely unlikely to the point of being impossible,
 # this software will most likely follow suit.
 
+basename() {
+	local f; f="${1##*/}"
+	[ -z "$2" ] || f="${f%$2}"
+	echo "$f"
+}
+
 SELF=$(basename $0)
 VERSION='1.2'
 
-- 
GitLab