You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
[[ 123 =~$(echo '^123\b') ]] &&echo match
Here's what shellcheck currently says:
Line 3:
[[ 123 =~ $(echo '^123\b') ]] && echo match
^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
Here's what I wanted or expected to see:
No warnings.
Since non-trivial regular expressions (to be matched with the =~ operator) can't be written inline, one needs a workaround, typically $(echo <expression>), which ideally should not raise a warning.
I'm also a bit perplexed about Shellcheck recognizing the =~ operator as a command, which causes the warning to be raises (however, I'm not familiar with the internals).
The text was updated successfully, but these errors were encountered:
For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
No warnings.
Since non-trivial regular expressions (to be matched with the
=~
operator) can't be written inline, one needs a workaround, typically$(echo <expression>)
, which ideally should not raise a warning.I'm also a bit perplexed about Shellcheck recognizing the
=~
operator as a command, which causes the warning to be raises (however, I'm not familiar with the internals).The text was updated successfully, but these errors were encountered: