re: A Guide To Loving Your Terminal VIEW POST

FULL DISCUSSION
 

Another bonus for the && syntax is that if the first command fails it will not run the second command.

This is useful if the second command relies on the first commands result (Like with your example updating packages).

If they're two separate commands that don't rely on each other then you can use ; instead.

 

Also || is a valuable tool on scripts, to exit or inform an error:

do_something_amazing || echo “nope” && exit 1

code of conduct - report abuse