Created
September 27, 2015 10:01
-
-
Save jpallari/92b3dee0e72b21dce405 to your computer and use it in GitHub Desktop.
Path management for Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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