From 1f86a61f96c48f7eea5c8305dd48de943fb03a5b Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Mon, 2 Apr 2018 14:28:54 +0200 Subject: [PATCH] Add cargo's bin directory to the $PATH --- .setpath.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.setpath.sh b/.setpath.sh index bbe8fa7..b954a24 100644 --- a/.setpath.sh +++ b/.setpath.sh @@ -1,6 +1,11 @@ -BIN_PATH="$HOME/.local/bin" -if [ -d "$BIN_PATH" ]; then - found=$(echo $PATH | tr ':' '\n' | grep -w "$BIN_PATH") - [ ! "$found" ] && export PATH="$BIN_PATH:$PATH" - true -fi +add_path() { + BIN_PATH="$1" + if [ -d "$BIN_PATH" ]; then + found=$(echo $PATH | tr ':' '\n' | grep -w "$BIN_PATH") + [ ! "$found" ] && export PATH="$BIN_PATH:$PATH" + true + fi +} + +add_path "$HOME/.local/bin" +add_path "$HOME/.cargo/bin"