aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/path.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/sh/shrc.d/path.sh b/sh/shrc.d/path.sh
index b6b1820f..70947515 100644
--- a/sh/shrc.d/path.sh
+++ b/sh/shrc.d/path.sh
@@ -5,15 +5,16 @@ path() {
case $1 in
# List current directories in PATH
- list|'') (
- path=$PATH:
- while [ -n "$path" ] ; do
- dir=${path%%:*}
- path=${path#*:}
- [ -n "$dir" ] || continue
- printf '%s\n' "$dir"
+ list|'')
+ set -- "$PATH":
+ while [ -n "$1" ] ; do
+ case $1 in
+ :*) ;;
+ *) printf '%s\n' "${1%%:*}" ;;
+ esac
+ set -- "${1#*:}"
done
- ) ;;
+ ;;
# Helper function checks directory argument makes sense
_argcheck)