DEV Community

Ali FELLAHI
Ali FELLAHI

Posted on

S.O Answer: Bash/sh - difference between && and ;

If you write bash/shell scripts you will often need to combine two or three commands in one line, especially if you use screen bash -c <cmd1 && cmd2 ; cmd3> command; but do you know what's the difference between && and ; separators? check this SO answer

If previous command failed with ; the second one will run.

But with && the second one will not run.

This is a "lazy" logical "AND" operand between operations.

Top comments (0)