I normally use ;
to combine more than one command in a line, but some people prefer &&
. Is there any difference? For example, cd ~; c
&&
allows for conditional execution while ;
always has the second command being executed.
In e.g. command1 && command2
, command2
will only execute when command1
has terminated with exit 0
, signalling all went well, while in command1 ; command2
the second command will always be executed no matter what the result was of command1
.