mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-22 19:17:34 +00:00
[provisioning] Clean up and fix path handling
This commit is contained in:
parent
c6c494d070
commit
834583bc86
1 changed files with 9 additions and 7 deletions
|
@ -6,21 +6,23 @@ function __addline {
|
|||
shift
|
||||
local line="$@"
|
||||
|
||||
grep "^$line\$" $filename || echo $line >> $filename
|
||||
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"
|
||||
test -r ~/.bash_profile && __addline ~/.bash_profile "export PATH='$1'":'"$PATH"'
|
||||
__addline ~/.profile "export PATH='$1'":'"$PATH"'
|
||||
__addline ~/.zshenv "export PATH='$1'":'"$PATH"'
|
||||
_profile "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"'
|
||||
_profile 'export PATH="$PATH"':"'$1'"
|
||||
}
|
||||
|
||||
function _path {
|
||||
|
|
Loading…
Reference in a new issue