From 5a50b6be661e81621f0d9818218a47ad440c6fef Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 12 Feb 2022 23:14:58 -0500 Subject: [PATCH] Simplify adding directories to path by using $path array --- .zshenv | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.zshenv b/.zshenv index b7ca723..4f0f2b0 100644 --- a/.zshenv +++ b/.zshenv @@ -20,17 +20,9 @@ export CALIBRE_USE_SYSTEM_THEME=true export WINEDLLOVERRIDES=winemenubuilder.exe=d -# Add $HOME/.bin to PATH if it exists and is not already in the path -if [[ -d "$HOME/.bin" ]] && ! grep -q ":$HOME"'/\.bin\(:\|$\)' <<< "$PATH" -then - export PATH="$PATH:$HOME/.bin" -fi - -# Add $HOME/.dotfiles to PATH if it exists and is not already in the path -if [[ -d "$HOME/.dotfiles" ]] && ! grep -q ":$HOME"'/\.dotfiles\(:\|$\)' <<< "$PATH" -then - export PATH="$PATH:$HOME/.dotfiles" -fi +# Don't allow duplicate values in path +typeset -U path +path=($HOME/.bin $HOME/.dotfiles/ $path) # Set temporary files locations if [[ ! -d "$TMPDIR" ]]