Skip to content

Instantly share code, notes, and snippets.

@jpallari
Created September 27, 2015 10:01
Show Gist options
  • Save jpallari/92b3dee0e72b21dce405 to your computer and use it in GitHub Desktop.
Save jpallari/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