Skip to content

Commit

Permalink
JSONPaths with spaces must be double-quoted on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
itowlson committed Jul 30, 2018
1 parent a4d264f commit e3a5710
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions content/en/docs/reference/kubectl/jsonpath.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
```

0 comments on commit e3a5710

Please sign in to comment.