Re:Sockets in Your Shell
by dllthomas on Thursday December 03, 2020 @06:44PM
(#25297063)
From one perspective,
is actually an instance of
because [ is itself a command.
[ Parent
| on HN ]
Re:Sockets in Your Shell
by gricardo99 on Thursday December 03, 2020 @11:35PM
(#25299004)
yep, I think that's the key point I need to drill into my head. The unix/linux idiom where 0 is true/success and non-zero is a failure can be counter-intuitive when combined with "if" (at least for me, hence my mistake reading the code). In most/other computing contexts "if 0" is never taken. I think this might explain why I've seen a lot more bash code that is explicitly written in the form more familiar to "if" usage in other languages (pseudo-code): "if res == 0". But "if COMMAND" is taking care of the interpretation of the return code, so doing the explicit compare is redundant.