Prefer well defined expressions#47
Conversation
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
|
Hi, I'm not currently the primary maintainer of cloud-utils, but I would like to offer my opinion on this change. First I'd like to say that shellcheck is a very useful lint tool. Second, with this change specifically:
I disagree with this for at least 2 reasons:
If you have a relevant example of where this code does not work as intended, please give example. We should absolutely fix it if it does not work as expected. My feeling is that there is cost but no value attached to changing code to accommodate either hypothetical situation or shell that is not relevant or used any where (even if that shell is arguably "compliant" to a standard). So my feeling is if you're going to apply 'lint' fixes to this code: |
|
@smoser thanks for your review & advice. I don't have an example. I just figured this change could make the code more robust. |
|
Hi @smoser and thanks @spotlesstofu for opening this PR.
shellcheck does run in c-i, but with On SC2166 (i.e. Anyway, @spotlesstofu you are right in that it would be good to improve the shellcheck compliance of the scripts. If you want to do so my suggestion here is to:
|
https://stackoverflow.com/questions/34755698/why-are-and-preferred-to-a-and-o