mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-18 11:06:17 +00:00
30 lines
515 B
Bash
30 lines
515 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 ~/.zshenv "$@"
|
|
}
|
|
|
|
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 $@
|
|
}
|