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
#!/usr/bin/env bashwhileread line;do
rev=$line
[[ "${rev#foo}"=="$rev" ]]
is_foo=$?# This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten. See SC2319.echo"$rev: $is_foo"done<$TEMP/foo.lst | sort
where is_foo=$? is flagged with SC2319. The expectation is for this line not to be flagged bc $? is being assigned.
Removing the pipe of while read ... to sort causes the SC2319 warning to disappear:
Min repro:
where
is_foo=$?
is flagged with SC2319. The expectation is for this line not to be flagged bc$?
is being assigned.Removing the pipe of
while read ...
tosort
causes the SC2319 warning to disappear:The text was updated successfully, but these errors were encountered: