test is frequently used in shell scripting, but is more likely to be seen in its symbolic link format, using the notation of the left square bracket symbol [


Accordingly, just like other shell programs, such as ls, it is actually a program and must therefore be surrounded by spaces:


test condition


[ condition ]


The returned result of test is going to be either TRUE or FALSE


Accordingly, the following examples, using the pseudo ternary construct, will perform the command after the && if the result of the test is successful, otherwise they will perform the result after the ||



test '1' && echo yep || echo no
test '' && echo yep || echo no

[ '1' ] && echo yep || echo no
[ '' ] && echo yep || echo no