Bash/sh - difference between && and ;

前端 未结 7 832
轮回少年
轮回少年 2020-12-07 11:22

I normally use ; to combine more than one command in a line, but some people prefer &&. Is there any difference? For example, cd ~; c

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 11:56

    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.

提交回复
热议问题