Open byrnejb opened 1 year ago
The \
seems to have no syntactic significance here. Why do you want to include it?
On Sat, February 18, 2023 14:26, Ryan Delaney wrote:
The
\
seems to have no syntactic significance here. Why do you want to include it?
Because this section of code is used for testing and I often cut and paste such sections into the shell after removing the comment #. The \ keeps the code together so that I can step though history to rerun it.
I could just make the code active in the script and surround it with another conditional block but having it commented out makes it crystal clear that the code section is not in use.
Regardless, I gather that this shell check is to detect interleaved comments in multi-line arguments and options passed to a single command parser; and not to detect comments in a if-then construct containing multiple commands.
If it is more bother than it is worth to alter the check then I can live with that. I just thought that you ought to know.
Regards,
-- e-Mail is NOT a SECURE channel Do NOT transmit sensitive data via e-Mail Unencrypted messages have no legal claim to privacy Do NOT open attachments nor follow links sent by e-Mail
James B. Byrne @.*** Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3
Because this section of code is used for testing and I often cut and paste such sections
Cut 'n' paste, such a gift ..
I recognise this pattern of coding, completely. No doubt, it is regularly employed.
I agree that # comment followed by \
should be exempt, a comment is a comment, after all.
Is this # comment \
syntax well defined by various shells ?
...
However, I choose to allow shellcheck
to draw a faint line-in-the-sand for me to act upon, accordingly.
For bugs
shellcheck --version
or "online"): 0.8.0For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Check SC1143 is intended to prevent premature termination of multi-line single commands. An IF-THEN-FI block is not a single multi-line command and yet this error is still reported.
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
Nothing