I often run the following commands, one after another. I wonder if it can be done with one line?
brew update
brew upgrade
brew cleanup
To run every command one after another:
brew update; brew upgrade; brew cleanup
To stop immediately after one of the commands fail:
brew update && brew upgrade && brew cleanup
This way, if update succeeds, and then upgrade failed, the cleanup will not run.
Both will execute commands from left to right.
Easily done. Just add a semi colon. So....
brew update; brew upgrade; brew cleanup;
This is the basics of writing your own BASH scripts. You can write complex scripts that are a single line.
echo thanks this is a test; echo ok here is new line, echo run another command here; ls; pwd; echo thanks i rock;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With