mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-23 11:15:00 +00:00
30 lines
517 B
Bash
30 lines
517 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
function __addline {
|
|
local filename=$1
|
|
shift
|
|
local line="$@"
|
|
|
|
grep "^$line\$" $filename >/dev/null || echo $line >> $filename
|
|
}
|
|
|
|
function _profile {
|
|
[ -w ~/.bash_profile ] && __addline ~/.bash_profile $@
|
|
__addline ~/.profile "$@"
|
|
__addline ~/.zprofile "$@"
|
|
}
|
|
|
|
function _path_low {
|
|
PATH="$1:$PATH"
|
|
_profile "export PATH='$1'":'"$PATH"'
|
|
}
|
|
|
|
function _path_high {
|
|
PATH="$PATH:$1"
|
|
_profile 'export PATH="$PATH"':"'$1'"
|
|
}
|
|
|
|
function _path {
|
|
_path_low $@
|
|
}
|