diff --git a/rc/01-functions.sh b/rc/01-functions.sh index 61db096..74a3627 100644 --- a/rc/01-functions.sh +++ b/rc/01-functions.sh @@ -31,12 +31,24 @@ function append_path() { fi } +function append_path_try() { + if [[ -e "$1" ]]; then + append_pat "$1" + fi +} + function prepend_path() { if ! in_path "$1"; then PATH="$1:$PATH" fi } +function prepend_path_try() { + if [[ -e "$1" ]]; then + prepend_path "$1" + fi +} + function uniq_path() { echo "$PATH" | tr ":" "\n" | awk '!seen[$0]++' | tr "\n" ":" | sed -r 's/:+/:/g' | sed -r 's/^:|:$//g' } @@ -71,7 +83,7 @@ function dump_args() { done } -function try_source() { +function source_try() { local script="$1" if [[ -e "$script" ]]; then source "$script"