如何 运行 一行写多个 brew 命令?

How to run multiple brew commands with one line?

我经常运行下面的命令,一个接一个。不知道一行能不能搞定?

brew update
brew upgrade
brew cleanup

轻松搞定。只需添加一个分号。所以....

brew update; brew upgrade; brew cleanup;

这是编写您自己的 BASH 脚本的基础知识。您可以编写单行的复杂脚本。

echo thanks this is a test; echo ok here is new line, echo run another command here; ls; pwd; echo thanks i rock;

到运行一个接一个的命令:

brew update; brew upgrade; brew cleanup

其中一个命令失败后立即停止:

brew update && brew upgrade && brew cleanup

这样,如果update成功,然后upgrade失败,cleanup就不会运行。

两者都会从左到右执行命令。