aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/bd.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh
index 02da6773..5b2c3d59 100644
--- a/sh/shrc.d/bd.sh
+++ b/sh/shrc.d/bd.sh
@@ -22,18 +22,18 @@ bd() {
# Keep chopping at the current directory until it's empty or it
# matches the request
- while [ -n "$2" ] ; do
- set -- "$1" "${2%/*}"
+ while set -- "$1" "${2%/*}" ; do
case $2 in
- (*/"$1") break ;;
+ */"$1") break ;;
+ */*) ;;
+ *)
+ printf >&2 'bd(): No match\n'
+ return 1
+ ;;
esac
done
# If the first argument ended up empty, we have no match
- if [ -z "$2" ] ; then
- printf >&2 'bd(): No match\n'
- return 1
- fi
shift
;;
esac