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

Spurious SC2086 warning on $PIPESTATUS #3145

Open
2 of 4 tasks
viavi-ab opened this issue Feb 11, 2025 · 0 comments
Open
2 of 4 tasks

Spurious SC2086 warning on $PIPESTATUS #3145

viavi-ab opened this issue Feb 11, 2025 · 0 comments

Comments

@viavi-ab
Copy link

For bugs

  • Rule Id (if any, e.g. SC1000): SC2086
  • My shellcheck version (shellcheck --version or 'online'): online
  • I tried on shellcheck.net and verified that this is still a problem on the latest commit
  • It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue

For new checks and feature suggestions

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

#! /bin/bash
# shellcheck disable=SC2181 # (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

[ $? -eq 0 ]
[ ${PIPESTATUS[0]} -eq 0 ]

Here's what shellcheck currently says:

Line 5	SC2086: Double quote to prevent globbing and word splitting.

Here's what I wanted or expected to see:

Nothing. Elements of the $PIPESTATUS array are numeric by definition. Just like $?, it doesn't need to doublequoted (at least not to prevent globbing and word splitting; you may want to quote it in case the particular element you're accessing is empty)

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