Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONPath example is invalid on Windows #9606

Closed
1 of 2 tasks
itowlson opened this issue Jul 22, 2018 · 2 comments
Closed
1 of 2 tasks

JSONPath example is invalid on Windows #9606

itowlson opened this issue Jul 22, 2018 · 2 comments

Comments

@itowlson
Copy link
Contributor

This is a...

  • Feature Request
  • Bug Report

Problem:

The page https://kubernetes.io/docs/reference/kubectl/jsonpath/ gives the following as an example of JSONPath usage:

kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.startTime}{"\n"}{end}'`

When I paste this into a Windows command prompt, I get the error error: error parsing jsonpath '{range, unclosed action.

Proposed Solution:

On Windows, you need to use double quotes around JSONPaths with spaces in them. This in turn means you need to use a single quote or an escaped double quote around literals:

kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{'\t'}{.status.startTime}{'\n'}{end}"
kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.startTime}{\"\n\"}{end}"

Page to Update:
https://kubernetes.io/docs/reference/kubectl/jsonpath/

@lucperkins
Copy link
Contributor

@itowlson Could you possibly submit a PR with these suggested changes?

@itowlson
Copy link
Contributor Author

@lucperkins PR submitted - #9679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants