From 0856d6d7137f3ddb5fe39180c6171d0b4fb79b2d Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Wed, 25 May 2022 14:22:16 +0200 Subject: [PATCH] added error redirection for k get-context and ssh-agent --- .functions/ps1.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.functions/ps1.sh b/.functions/ps1.sh index 5fcdab0..74a09d7 100644 --- a/.functions/ps1.sh +++ b/.functions/ps1.sh @@ -49,7 +49,7 @@ function bash_ps1 () { fi [[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]" if [[ $(type kubectl) ]]; then - CURRENT_CONTEXT="$(kubectl config current-context)" + CURRENT_CONTEXT="$(kubectl config current-context 2>/dev/null)" if [[ "$CURRENT_CONTEXT" != "default" ]];then K8S_CURRENT_CONTEXT="${PS1_COLOR_DIVIDER}[${PS1_COLOR_KUBERNETES}${CURRENT_CONTEXT}${PS1_COLOR_DIVIDER}]" fi @@ -74,7 +74,7 @@ function bash_ps1 () { fi 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" fi fi