2 ms·
I think using test would be the best, even if it's awkward, but [[ is a Bashism (so not POSIX shell compatible), and [ is jut an alias for test and requires tha
by pas 4y ago
I think using test would be the best, even if it's awkward, but [[ is a Bashism (so not POSIX shell compatible), and [ is jut an alias for test and requires that dumb closing bracket, and you are already execve()-ing a separate program for comparison, you are already depending on the exit code, so why not make it explicit by using test.
(I continue to use [[ and never look back, just forward, trying to picture the shining city on a conveniently sloped hill, where people live without fear in their hearts, where they have compile time checking for their scripts, and the compiler gently pushes them toward sane error handling. Not too much, but definitely not too little. Something like Rust's Result type.)