(NOTE: There is a very similar question, asked yesterday oddly enough, but it doesn't cover the main syntaxes I'm concerned with. If I were to update the other question to include them it might render the answers no longer valid, so I'll focus here on what was missed in the other question. Anyone who wants the whole picture should look at both questions and their accepted answers.)
I typically write my if statements as follows:
if [[ -z "$SOMETHING" ]]; then # blah blah blah fi
which works well for me under Bash and Z Shell, but I recently came across a syntax which drops the square brackets entirely:
if command -v given-command > /dev/null 2>&1; then echo given-command is available else echo given-command is not available fi
Is the version without any brackets portable? How does it compare to the options presented here?
Is my standard version mainly only supported on Bash and Z Shell (like the
[[ -w /home/durrantm ]] && echo "writable" version mentioned on that other question)?