News for hackers. Stuff that matters.
Re:My Favorite One Liners by j1elo on Monday May 03, 2021 @02:45PM (#27029061)
Note ShellCheck's SC2015, especially if you do stuff with permanent consequences in the place of "say":

"A && B || C is not if-then-else. C may run when A is true":

https://github.com/koalaman/shellcheck/wiki/SC2015

Re:My Favorite One Liners by yesenadam on Monday May 03, 2021 @08:05PM (#27032518)
Interesting! Good to know, thanks. I never mix && and || in the same line, but didn't know exactly why that is!

The problem is that "In this case, if A is true but B is false, C will run."

I guess with B as "say", B will never be false, but generally it's really not the same as if-then-else.