adding pathdel

This commit is contained in:
tengel 2024-03-20 11:28:46 -05:00
parent 354abad454
commit 84b396e0bb

16
shell/pathdel.sh Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: MIT
# handy function to cleanly remove a PATH element
function pathdel() {
local _PDEL=$1
PATH=:$PATH:
PATH=${PATH//:$_PDEL:/:}
PATH=${PATH#:};
PATH=${PATH%:}
export PATH
}
pathdel /some/random/bin
echo "$PATH"