From 1ad81ff42d1d4ca456b19d2807c9d2d880f119bf Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 20 Oct 2021 21:01:09 +0200 Subject: [PATCH] avoid a pipe and grep invocation in `ADDPATH` --- home/-shrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home/-shrc b/home/-shrc index d377289..5d92436 100644 --- a/home/-shrc +++ b/home/-shrc @@ -26,7 +26,10 @@ ADDPATH() { ### @- append a directory to `$PATH` if it isn't already present. printf 'ADDPATH: path does not exist: %s\n' "$1" >&2 return 1 fi - printf '%s' ":$PATH:" | grep -Fq ":$new:" || export PATH="$PATH:$new" + case ":$PATH:" in + (*":$new:"*) :;; + (*) export PATH="$PATH:$new";; + esac } # {{{1 configurations