From ad78c2a78f54c271acc34eacfecaeca802bc1277 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Fri, 13 Feb 2015 13:07:26 +0100 Subject: [PATCH] Checking whether or not the path has already been exported --- .bashrc | 2 +- .zshrc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index c02c7c4..9198019 100644 --- a/.bashrc +++ b/.bashrc @@ -28,7 +28,7 @@ fi # Custom bin directory if [ -d "$HOME/bin" ]; then - export PATH="$PATH:$HOME/bin" + [[ ":$PATH:" == *":$HOME/bin:"* ]] || export PATH="$PATH:$HOME/bin" fi # OS diff --git a/.zshrc b/.zshrc index f990096..bc043d6 100644 --- a/.zshrc +++ b/.zshrc @@ -5,7 +5,7 @@ export CLICOLOR=1 export EDITOR='emacs' export PAGER='less' export USER_NICKNAME="Rodolphe Breard" -export PATH="$PATH:$HOME/bin" +[[ ":$PATH:" == *":$HOME/bin:"* ]] || export PATH="$PATH:$HOME/bin" setopt nobeep appendhistory histignoredups histignorespace autocd extendedglob nomatch notify correct_all @@ -47,7 +47,9 @@ fi export GPG_TTY=$(tty) # rbenv -hash rbenv 2>/dev/null && eval "$(rbenv init -)" +if [[ ! ":$PATH:" == *":$HOME/.rbenv/shims:"* ]]; then + hash rbenv 2>/dev/null && eval "$(rbenv init -)" +fi # Aliases if [ "$(uname -s | tr '[:upper:]' '[:lower:]')" = 'linux' ]; then