lib/helpers: be extra careful with word splitting
Use curly braces when `$1` is unseparated from words in a string.pull/1934/head
parent
550f808884
commit
317ff77810
|
|
@ -727,7 +727,7 @@ function _on-disable-callback() {
|
||||||
_example '$ _on-disable-callback gitstatus'
|
_example '$ _on-disable-callback gitstatus'
|
||||||
_group 'lib'
|
_group 'lib'
|
||||||
|
|
||||||
callback="$1_on_disable"
|
callback="${1}_on_disable"
|
||||||
_command_exists "$callback" && "$callback"
|
_command_exists "$callback" && "$callback"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -946,7 +946,7 @@ function _help-aliases() {
|
||||||
alias_path='custom.aliases.bash'
|
alias_path='custom.aliases.bash'
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
alias_path="available/$1.aliases.bash"
|
alias_path="available/${1}.aliases.bash"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
metafor alias < "${BASH_IT}/aliases/$alias_path" | sed "s/$/'/"
|
metafor alias < "${BASH_IT}/aliases/$alias_path" | sed "s/$/'/"
|
||||||
|
|
@ -1039,11 +1039,11 @@ function pathmunge() {
|
||||||
example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
example 'pathmunge /path/to/dir is equivalent to PATH=/path/to/dir:$PATH'
|
||||||
example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
example 'pathmunge /path/to/dir after is equivalent to PATH=$PATH:/path/to/dir'
|
||||||
|
|
||||||
if [[ -d "${1:-}" && ! $PATH =~ (^|:)$1($|:) ]]; then
|
if [[ -d "${1:-}" && ! $PATH =~ (^|:)"${1}"($|:) ]]; then
|
||||||
if [[ "${2:-}" == "after" ]]; then
|
if [[ "${2:-}" == "after" ]]; then
|
||||||
export PATH=$PATH:$1
|
export PATH="$PATH:${1}"
|
||||||
else
|
else
|
||||||
export PATH=$1:$PATH
|
export PATH="${1}:$PATH"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue