mirror of
https://github.com/notwa/rc
synced 2024-04-28 10:23:23 -07:00
avoid a pipe and grep invocation in ADDPATH
This commit is contained in:
parent
5c3dce9aa5
commit
1ad81ff42d
|
@ -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
|
printf 'ADDPATH: path does not exist: %s\n' "$1" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf '%s' ":$PATH:" | grep -Fq ":$new:" || export PATH="$PATH:$new"
|
case ":$PATH:" in
|
||||||
|
(*":$new:"*) :;;
|
||||||
|
(*) export PATH="$PATH:$new";;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# {{{1 configurations
|
# {{{1 configurations
|
||||||
|
|
Loading…
Reference in New Issue
Block a user