aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dot_config/environment.d/01_PATH.conf19
1 files changed, 16 insertions, 3 deletions
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