From d774743aa51e8dc48724f37ccc71bea23b0f0311 Mon Sep 17 00:00:00 2001 From: pks Date: Sat, 24 Jul 2021 15:32:09 +0200 Subject: zsh: maybe_add_dir_to_path --- zsh/.zshrc | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 14926af..0214765 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -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 -- cgit v1.2.3