Comment Comment by t43562 FWIW in bash I have 2 functions: path_add() { export PATH=$PATH:$(string_join ':' $@) } path_prepend() { PATH=$(string_join ':' "$@"):$PATH export PATH } These can join an arbitrary list of paths to PATH. e.g. path_add /usr/bin /usr/local/bin ~/bin They depend on another one: string_join() { local join=$1; shift local result=$1; shift for p in "$@"; do result="${result}${join}${p}" done echo -n "$result" set +x } I also have ones for adding and prepending to LD_LIBRARY_PATH parent t43562 1 year ago