From db9d1b77179e4d1f0ba6ba2606879a3dfd20f9b5 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Tue, 16 Apr 2024 11:18:53 -0400 Subject: smarter PATH setting --- dot_config/environment.d/01_PATH.conf | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'dot_config') diff --git a/dot_config/environment.d/01_PATH.conf b/dot_config/environment.d/01_PATH.conf index e342e30..104fba4 100644 --- a/dot_config/environment.d/01_PATH.conf +++ b/dot_config/environment.d/01_PATH.conf @@ -1,3 +1,16 @@ -PATH=${PATH:-/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games} -PATH=${HOME}/.cargo/bin:${PATH} -PATH=${HOME}/bin:${PATH} +PATH="${PATH:-/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games}" +for dir in \ + "/usr/games" \ + "/usr/sbin" \ + "/sbin" \ + "${HOME}/.cabal/bin" \ + "${HOME}/.cargo/bin" \ + "${HOME}/bin"; do + case :$PATH: in + *:${dir}:*) + # ${dir} already in PATH + ;; + *) + PATH="${dir}:${PATH}";; + esac +done -- cgit v1.2.3