On Wednesday, July 25, 2018 4:03:46 PM CEST Thorsten Glaser wrote:
> Pavel Raiskup dixit:
> 
> >ShellCheck dislikes unused variables in 'read unused_var', rather
> >use 'read _'.
> 
> That’s bad advice. It’s better to name the fields,
> even if the variables themselves may be unused, to
> easen later maintenance.

Since you've sent a general statement, I disagree *in general* -- in
later maintenance you might very easily get into situation that the
very same variable is used in different context, and then you have the
variable _predefined_ unintentionally by by 'read'.  That's why I
consider that warning to be useful, and why I usually want to be
friendly to ShellCheck.

Speaking concretely, the 'xzmore' doesn't pollute variable namespace
since it's enclosed in $(...), so it's safe and I'm fine to ignore
that.  The proposed fix would really only be about making the output
from static analysis a bit more useful/readable (btw. ditto for the
second issue).

Pavel




Reply via email to