added error redirection for k get-context and ssh-agent

This commit is contained in:
Jonas Forsberg 2022-05-25 14:22:16 +02:00
parent 63448ef3b9
commit 0856d6d713
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -49,7 +49,7 @@ function bash_ps1 () {
fi fi
[[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]" [[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]"
if [[ $(type kubectl) ]]; then if [[ $(type kubectl) ]]; then
CURRENT_CONTEXT="$(kubectl config current-context)" CURRENT_CONTEXT="$(kubectl config current-context 2>/dev/null)"
if [[ "$CURRENT_CONTEXT" != "default" ]];then if [[ "$CURRENT_CONTEXT" != "default" ]];then
K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]" K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]"
fi fi
@ -74,7 +74,7 @@ function bash_ps1 () {
fi fi
if type -t ssh-add > /dev/null;then if type -t ssh-add > /dev/null;then
if [[ "$(ssh-add -L | grep -E -c '^ssh')" == "0" ]];then if [[ "$(ssh-add -L 2>/dev/null | grep -E -c '^ssh')" == "0" ]];then
STATUS="${STATUS}${PS1_COLOR_SSH}s" STATUS="${STATUS}${PS1_COLOR_SSH}s"
fi fi
fi fi