[bash] fix shellcheck error SC2166

For details, see:

    https://github.com/koalaman/shellcheck/wiki/SC2166
This commit is contained in:
Fernando Schauenburg 2020-12-03 18:34:17 +01:00
parent 93cea206a6
commit eef6e7d58f

View file

@ -40,7 +40,7 @@ export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
[ "$(uname)" == "Darwin" ] && { PATH=""; source /etc/profile; } [ "$(uname)" == "Darwin" ] && { PATH=""; source /etc/profile; }
prepend_dir() { # 1: dir to add, 2: variable to manipulate prepend_dir() { # 1: dir to add, 2: variable to manipulate
[ -d "$1" -a -n "$2" ] || return [ -d "$1" ] && [ -n "$2" ] || return
local list="${!2}" # capture current value local list="${!2}" # capture current value
list=${list#"$1:"} # remove dir from beginning list=${list#"$1:"} # remove dir from beginning
list=${list//":$1:"/:} # remove dir from middle list=${list//":$1:"/:} # remove dir from middle