In some scripts, I've seen
if conditional statements written as:
if [ some_conditional_statement ]; then # do stuff fi
[ some_conditional_statement ] && #do stuff
Is the second example equivalent (do stuff portion will only execute if the conditional is true), but only useful when you only need to perform one command such as:
[ -f "/path/to/some/file" ] && . /path/to/some/file
Or is there another difference I am missing?