adding pathdel
This commit is contained in:
parent
354abad454
commit
84b396e0bb
1 changed files with 16 additions and 0 deletions
16
shell/pathdel.sh
Executable file
16
shell/pathdel.sh
Executable 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"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue