diff options
author | pks <pks@pks.rocks> | 2021-07-24 15:32:09 +0200 |
---|---|---|
committer | pks <pks@pks.rocks> | 2021-07-24 15:32:09 +0200 |
commit | d774743aa51e8dc48724f37ccc71bea23b0f0311 (patch) | |
tree | 8267c0c60823593704c0359e12054ee06005e8f2 | |
parent | ae76755ed7fd3e12a50123bc99b725e0b3225764 (diff) |
zsh: maybe_add_dir_to_path
-rw-r--r-- | zsh/.zshrc | 32 |
1 files changed, 15 insertions, 17 deletions
@@ -175,27 +175,25 @@ export MANPATH=$MANPATH:$HOME/.local/share/man export GOPATH=$HOME/.local -# local_bin -if [[ -d ~/local_bin ]]; then - export PATH=~/local_bin:$PATH -elif [[ -d ~/.sync/local_bin ]]; then - export PATH=~/.sync/local_bin:$PATH -fi - -# nlp_scripts -if [[ -d ~/nlp_scripts ]]; then - export PATH=~/nlp_scripts:$PATH -elif [[ -d ~/.sync/nlp_scripts ]]; then - export PATH=~/.sync/nlp_scripts:$PATH -fi +function maybe_add_dir_to_path { + if [[ -d $1 ]]; then + export PATH=$1:$PATH; + fi +} -if [[ -d /usr/lib/colorgcc/bin ]]; then - PATH=/usr/lib/colorgcc/bin:$PATH -fi +maybe_add_dir_to_path ~/local_bin:$PATH +maybe_add_dir_to_path /home/pks/local_bin:$PATH +maybe_add_dir_to_path ~/.sync/local_bin:$PATH +maybe_add_dir_to_path /home/pks/.sync/local_bin:$PATH +maybe_add_dir_to_path ~/nlp_scripts +maybe_add_dir_to_path /home/pks/nlp_scripts +maybe_add_dir_to_path ~/.sync/nlp_scripts +maybe_add_dir_to_path /home/pks/.sync/nlp_scripts +maybe_add_dir_to_path /usr/lib/colorgcc/bin which R &>/dev/null if [[ $? == 0 ]]; then - export R_LIBS_USER=$HOME/.R + maybe_add_dir_to_path $HOME/.R fi if [[ -x $(which nvim &>/dev/null) ]]; then |