I am trying to execute a bash
command in python
The bash command I want to execute is: kubectl get ns | grep -E '(^|\s)OK($|\s)'
And in python I do this like this:
is_namespace_exists = subprocess.call(["kubectl", "get", "ns", "|", "grep", "-E", "\'(^|\s)"+NAMESPACE+"($|\s)\'"])
and
is_namespace_exists = subprocess.call(["kubectl", "get", "ns", "|", "grep", "-E", "'(^|\s)"+NAMESPACE+"($|\s)'"])
But I get this error:
unknown shorthand flag: 'E' in -E
Can someone tell me what is going wrong?