From aca05367250d91e7336ad3ec53b2585204eefd00 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Tue, 28 Mar 2017 21:59:53 -0700 Subject: [PATCH] Fix unrecognized flag handling If the values in a=b format matches -(.*), unrecognized flag error is triggeed, using ^pattern to handle this. Signed-off-by: Ahmet Alp Balkan --- kubectx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubectx b/kubectx index 2d11fec..923615d 100755 --- a/kubectx +++ b/kubectx @@ -134,7 +134,7 @@ main() { swap_context elif [[ "${1}" == '-h' || "${1}" == '--help' ]]; then usage - elif [[ "${1}" =~ -(.*) ]]; then + elif [[ "${1}" =~ ^-(.*) ]]; then echo "error: unrecognized flag" >&2; usage elif [[ "${1}" =~ (.+)=(.+) ]]; then alias_context "${BASH_REMATCH[2]}" "${BASH_REMATCH[1]}"