mirror of
https://github.com/correl/dotfiles.git
synced 2024-11-25 03:00:05 +00:00
28 lines
668 B
Bash
28 lines
668 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
function __addline {
|
|
local filename=$1
|
|
shift
|
|
local line="$@"
|
|
|
|
grep "^$line\$" $filename || echo $line >> $filename
|
|
}
|
|
|
|
function _path_low {
|
|
PATH="$1:$PATH"
|
|
test -r ~/.bash_profile && __addline ~/.bash_profile "export PATH='$1'":'"$PATH"'
|
|
__addline ~/.profile "export PATH='$1'":'"$PATH"'
|
|
__addline ~/.zshenv "export PATH='$1'":'"$PATH"'
|
|
}
|
|
|
|
function _path_high {
|
|
PATH="$PATH:$1"
|
|
test -r ~/.bash_profile && __addline ~/.bash_profile 'export PATH="$PATH"':"'$PATH'"
|
|
__addline ~/.profile "export PATH='$1'":'"$PATH"'
|
|
__addline ~/.zshenv "export PATH='$1'":'"$PATH"'
|
|
}
|
|
|
|
function _path {
|
|
_path_low $@
|
|
}
|