From e3a57107445a5619afa8381e7c1de1e35ea27e19 Mon Sep 17 00:00:00 2001 From: Ivan Towlson Date: Tue, 31 Jul 2018 11:01:22 +1200 Subject: [PATCH] JSONPaths with spaces must be double-quoted on Windows --- content/en/docs/reference/kubectl/jsonpath.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/en/docs/reference/kubectl/jsonpath.md b/content/en/docs/reference/kubectl/jsonpath.md index 78f1bf711c70e..8f111f28753c6 100644 --- a/content/en/docs/reference/kubectl/jsonpath.md +++ b/content/en/docs/reference/kubectl/jsonpath.md @@ -73,3 +73,10 @@ $ kubectl get pods -o=jsonpath='{.items[0]}' $ kubectl get pods -o=jsonpath='{.items[0].metadata.name}' $ kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}' ``` + +On Windows, you must _double_ quote any JSONPath template that contains spaces (not single quote as shown above for bash). This in turn means that you must use a single quote or escaped double quote around any literals in the template. For example: + +```cmd +C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}" +C:\> kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}" +```