Skip to content

Instantly share code, notes, and snippets.

@oowekyala
Created December 6, 2023 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oowekyala/36719cbe8a7c2362ca681230895efd71 to your computer and use it in GitHub Desktop.
Save oowekyala/36719cbe8a7c2362ca681230895efd71 to your computer and use it in GitHub Desktop.
PATH manipulation functions for your shell
prepend_PATH() {
export PATH="$1:$PATH"
}
append_PATH() {
export PATH="$PATH:$1"
}
# Delete some part of the path
# https://unix.stackexchange.com/questions/108873/removing-a-directory-from-path
delete_from_PATH() {
local search="$1"
export PATH=`echo $PATH | tr ":" "\n" | grep -v "$search" | tr "\n" ":"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment