巴什/ SH - 之间及功放差异;&安培;和; [英] Bash/sh - difference between && and ;?
本文介绍了巴什/ SH - 之间及功放差异;&安培;和;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通常使用;
多个命令行结合起来,但有些人preFER &放大器;&安培;
。有什么区别吗?例如, CD〜; CD -
和 CD〜&放大器;&安培; CD -
似乎让同样的事情。什么版本更便携,例如将由类似Android的壳左右bash的子集的支持?
I normally use ;
to combine more than one command in a line, but some people prefer &&
. Is there any difference? For example, cd ~; cd -
and cd ~ && cd -
seems to make the same thing. What version is more portable, e.g. will be supported by a bash-subset like Android's shell or so?
推荐答案
如果previous命令失败;
第二个将运行
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.
这篇关于巴什/ SH - 之间及功放差异;&安培;和;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文