From 8342f7b3e776ebc482ba87723ba40015d2dab64e Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Fri, 24 Nov 2023 16:17:47 -0500 Subject: Fix bug that appended paths multiple times in PATH --- config/bash/bashrc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/config/bash/bashrc b/config/bash/bashrc index 7f0abff..4d5178f 100644 --- a/config/bash/bashrc +++ b/config/bash/bashrc @@ -78,12 +78,17 @@ PS1='\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1 # Environment # =========== -# FIXME: This is executed twice. One just after login (first bash) in tty. And -# again then again in the terminal emulator. -PATH="$HOME/.local/bin:$PATH" -PATH="$HOME/mahcode/bin:$PATH" -PATH="$HOME/code/tex-live-native/build/bin/x86_64-linux:$PATH" -export PATH +# Add directories to PATH +ds=( + "$HOME/code/tex-live-native/build/bin/x86_64-linux" + "$HOME/.local/bin" + "$HOME/mahcode/dotfiles/local/bin" +) +for d in "${ds[@]}"; do + if ! echo $PATH | grep -qE "(^|:)$d($|:)"; then + export PATH="$d:$PATH" + fi +done export MANPATH="$HOME/code/tex-live-native/build/texmf-dist/doc/man:$MANPATH" export INFOPATH="$HOME/code/tex-live-native/build/texmf-dist/doc/man:$INFOPATH" -- cgit v1.2.3