X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/794f0aac869dda034300211e9be45db123d84377..bdf40d5f42978132658bee5f955b52f7de6dcc93:/vcsh diff --git a/vcsh b/vcsh index c9c706b..d742cf4 100755 --- a/vcsh +++ b/vcsh @@ -13,9 +13,11 @@ # 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) @@ -29,7 +31,7 @@ fatal() { # We need to run getops as soon as possible so we catch -d and other # options that will modify our behaviour. # Commands are handled at the end of this script. -while getopts "c:dv" flag; do +while getopts "c:dv" flag; do if [ "$1" = '-d' ] || [ "$1" = '--debug' ]; then set -vx VCSH_DEBUG=1