From 3843d03281b3ca98bd51b77589ce39fbe6bb9b93 Mon Sep 17 00:00:00 2001 From: Patrick McDonald <66495007+eieioxyz@users.noreply.github.com> Date: Tue, 30 Jun 2020 09:54:47 -0400 Subject: [PATCH] Enforce unique $path locations with typeset -U Related: #5 --- setup_node.zsh | 2 +- zshrc | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup_node.zsh b/setup_node.zsh index e06db83..ce0bdff 100755 --- a/setup_node.zsh +++ b/setup_node.zsh @@ -3,7 +3,7 @@ echo "\n<<< Starting Node Setup >>>\n" # Node versions are managed with `n`, which is in the Brewfile. -# See zshrc for N_PREFIX variable and addition to PATH. +# See zshrc for N_PREFIX variable and addition to $path array. if exists node; then echo "Node $(node --version) & NPM $(npm --version) already installed" diff --git a/zshrc b/zshrc index 388974c..1e3f0a4 100644 --- a/zshrc +++ b/zshrc @@ -27,9 +27,14 @@ PROMPT=' RPROMPT='%*' -# Add Locations to $PATH Variable -export PATH="$N_PREFIX/bin:$PATH" -export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" +# Add Locations to $path Array +typeset -U path + +path=( + "$N_PREFIX/bin" + $path + "/Applications/Visual Studio Code.app/Contents/Resources/app/bin" +) # Write Handy Functions