[Solved] What is the difference between && and ; in bash or command?


~$ echo one && echo two

This runs the 2. command only if the first command succeeds.

~$ echo one ; echo two

This always runs the 2. command.

~$ echo one || echo two

This runs the 2. command only if the first command fails.

A command is considered successful if its exit code is 0, and considered failed if
its exit code is != 0.

solved What is the difference between && and ; in bash or command?