Skip to content

Instantly share code, notes, and snippets.

@jkpl
Created September 27, 2015 10:01
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 jkpl/92b3dee0e72b21dce405 to your computer and use it in GitHub Desktop.
Save jkpl/92b3dee0e72b21dce405 to your computer and use it in GitHub Desktop.
Path management for Bash
function join {
local IFS="$1"
shift
echo "$*"
}
export CUSTOM_PATHS=(
"$HOME/Apps/myapp"
"$HOME/Apps/myapp2/bin"
)
export DEFAULT_PATH="$PATH:`join : ${CUSTOM_PATHS[@]}`"
export PATH="$DEFAULT_PATH"
function reset_path {
export PATH="$DEFAULT_PATH"
}
function add_path {
export PATH="$DEFAULT_PATH:$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment