commit
40d6b40f66
|
|
@ -464,11 +464,22 @@ function aws_profile {
|
||||||
}
|
}
|
||||||
|
|
||||||
function safe_append_prompt_command {
|
function safe_append_prompt_command {
|
||||||
if [[ -n $1 ]] ; then
|
local prompt_re
|
||||||
case $PROMPT_COMMAND in
|
|
||||||
*$1*) ;;
|
# Set OS dependent exact match regular expression
|
||||||
"") PROMPT_COMMAND="$1";;
|
if [[ ${OSTYPE} == darwin* ]]; then
|
||||||
*) PROMPT_COMMAND="$1;$PROMPT_COMMAND";;
|
# macOS
|
||||||
esac
|
prompt_re="[[:<:]]${1}[[:>:]]"
|
||||||
|
else
|
||||||
|
# Linux, FreeBSD, etc.
|
||||||
|
prompt_re="\<${1}\>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
|
||||||
|
return
|
||||||
|
elif [[ -z ${PROMPT_COMMAND} ]]; then
|
||||||
|
PROMPT_COMMAND="${1}"
|
||||||
|
else
|
||||||
|
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue