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

Piping output of jq to tr to get rid of quotes #2177

Open
2 tasks done
JCGoran opened this issue Mar 15, 2021 · 0 comments
Open
2 tasks done

Piping output of jq to tr to get rid of quotes #2177

JCGoran opened this issue Mar 15, 2021 · 0 comments

Comments

@JCGoran
Copy link

JCGoran commented Mar 15, 2021

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

The jq program is sometimes used like this:

$ printf '"string\\\""' | jq '.' | tr -d '"'
string\

but the user probably intended the output to be something like this instead (and this seems to be a frequent question):

$ printf '"string\\\""' | jq -r '.'
string"

Here's what shellcheck currently says:

Nothing.

Here's what I wanted or expected to see:

Emit a warning to not use tr, but instead use the -r (--raw-output) flag of jq.

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

1 participant