scripts/shell/pathdel.sh
2024-03-20 11:28:46 -05:00

16 lines
274 B
Bash
Executable file

#!/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"