diff --git a/.functions/ps1.sh b/.functions/ps1.sh index f45c8cf..313b34a 100644 --- a/.functions/ps1.sh +++ b/.functions/ps1.sh @@ -48,7 +48,7 @@ function bash_ps1 () { fi fi [[ -n "$VIRTUAL_ENV" ]] && PYTHON_ENV="${PS1_COLOR_DIVIDER}─[${PS1_COLOR_VENV}${VIRTUAL_ENV##*/}${PS1_COLOR_DIVIDER}]" - if [[ $(type kubectl) ]]; then + if command -v kubectl > /dev/null; then 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}]"