aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-26 12:45:01 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-09-26 12:45:01 +1300
commiteb32901feddce045f359c5bd2d59ade9aaf467ee (patch)
treeb64f17f2b63fed8aee41fad65c5e08a86dc451ab /sh
parentUpdate submodules (diff)
downloaddotfiles-eb32901feddce045f359c5bd2d59ade9aaf467ee.tar.gz
dotfiles-eb32901feddce045f359c5bd2d59ade9aaf467ee.zip
Use simpler method for `path check`
Easier to read and does not require a subshell
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/path.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/sh/shrc.d/path.sh b/sh/shrc.d/path.sh
index a5940dd7..2513b0e5 100644
--- a/sh/shrc.d/path.sh
+++ b/sh/shrc.d/path.sh
@@ -58,11 +58,12 @@ path() {
;;
# Check whether a directory is in PATH
- check) (
- # shellcheck disable=SC2030
- path=:$PATH:
- [ "$path" != "${path%:"$2":*}" ]
- ) ;;
+ check)
+ case :$PATH: in
+ *:"$2":*) return 0 ;;
+ esac
+ return 1
+ ;;
# Print help output (also done if command not found)
help)