mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
match against whole PATH segments
string replacement still doesn't match against asdf segments when last in PATH
This commit is contained in:
parent
f8c9e97900
commit
d3895f593c
8
asdf.sh
8
asdf.sh
@ -13,10 +13,10 @@ ASDF_DIR="$(cd "$(dirname "$current_script_path")" &> /dev/null || exit 1; pwd)"
|
|||||||
#
|
#
|
||||||
# if in $PATH, remove, regardless of if it is in the right place (at the front) or not.
|
# if in $PATH, remove, regardless of if it is in the right place (at the front) or not.
|
||||||
# replace all occurrences - ${parameter//pattern/string}
|
# replace all occurrences - ${parameter//pattern/string}
|
||||||
ASDF_BIN="${ASDF_DIR}/bin:"
|
ASDF_BIN="${ASDF_DIR}/bin"
|
||||||
ASDF_SHIMS="${ASDF_DIR}/shims:"
|
ASDF_SHIMS="${ASDF_DIR}/shims"
|
||||||
[[ ":$PATH:" == *"${ASDF_BIN}"* ]] && PATH="${PATH//$ASDF_BIN/}"
|
[[ ":$PATH:" == *":${ASDF_BIN}:"* ]] && PATH="${PATH//$ASDF_BIN:/}"
|
||||||
[[ ":$PATH:" == *"${ASDF_SHIMS}"* ]] && PATH="${PATH//$ASDF_SHIMS/}"
|
[[ ":$PATH:" == *":${ASDF_SHIMS}:"* ]] && PATH="${PATH//$ASDF_SHIMS:/}"
|
||||||
# add to front of $PATH
|
# add to front of $PATH
|
||||||
PATH="${ASDF_BIN}$PATH"
|
PATH="${ASDF_BIN}$PATH"
|
||||||
PATH="${ASDF_SHIMS}$PATH"
|
PATH="${ASDF_SHIMS}$PATH"
|
||||||
|
Loading…
Reference in New Issue
Block a user