Add bash functions
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user