I have seen this construct in scripts a lot and used it myself, but it bothers me that I can't seem to find it in the documentation.
[ -f file1 ] && [ -f file2 ] && echo "Both files exist." || echo "One or the other file doesn't exist."
This could also be done with backslashes before the newlines, as mentioned in
If a \<newline> pair appears, and the backslash is not itself quoted, the \<newline> is treated as a line continuation (that is, it is removed from the input stream and effectively ignored).
[ -f file1 ] && \ [ -f file2 ] && \ echo "Both files exist." || \ echo "One or the other file doesn't exist."
...but this doesn't seem to be necessary. The first version above works even without the backslashes.
Where can I find this in
man bash? (Also, is this
bash specific or POSIX compliant?)