diff --git a/kubectx b/kubectx index 3da322f..67714aa 100755 --- a/kubectx +++ b/kubectx @@ -59,7 +59,7 @@ list_contexts() { normal=$(tput sgr0) for c in $(get_contexts); do - if [[ "${c}" = "${cur}" ]]; then + if [[ -t 1 && "${c}" = "${cur}" ]]; then echo "${darkbg}${yellow}${c}${normal}" else echo "${c}" diff --git a/kubens b/kubens index 93fbb86..28affc4 100755 --- a/kubens +++ b/kubens @@ -113,7 +113,7 @@ list_namespaces() { cur="$(current_namespace)" ns_list=$(get_namespaces) for c in $ns_list; do - if [[ "${c}" = "${cur}" ]]; then + if [[ -t 1 && "${c}" = "${cur}" ]]; then echo "${darkbg}${yellow}${c}${normal}" else echo "${c}"