From c0b024974a7334ca2810f000b5dc41f1a93ad6de Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Fri, 21 Feb 2020 11:03:59 +0100 Subject: [PATCH] Fix PATH manipulation bug in bash profile This bug caused entries to not be removed if they were already present in the beginning of the list before being prepended. This could lead to duplication of entires, usually this ended up being /usr/local/bin. --- dotfiles/.config/bash/profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/.config/bash/profile b/dotfiles/.config/bash/profile index cb81693..2db3b9f 100644 --- a/dotfiles/.config/bash/profile +++ b/dotfiles/.config/bash/profile @@ -36,7 +36,7 @@ export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC' prepend_dir() { # 1: dir to add, 2: variable to manipulate [ -d "$1" -a -n "$2" ] || return local list="${!2}" # capture current value - list=${list#"$1sep"} # remove dir from beginning + list=${list#"$1:"} # remove dir from beginning list=${list//":$1:"/:} # remove dir from middle list=${list%":$1"} # remove dir from end printf -v "$2" "$1${list:+":$list"}" # add in front (use : only if empty)