$ echo whats up && echo goodbye whats up goodbye
If, alternatively, the command on the left facet fails, the command on the fitting facet will not be run. The AND logic (run each instructions) merely offers up. The command line simply stops with the preliminary failure. Discover that the “no shock there” string beneath will not be displayed.
$ cat nosuchfile && echo no shock there cat: nosuchfile: No such file or listing
Combining || and &&
There’s no motive which you could’t use each || and && operators in a single command. Doing so simply makes the parsing a bit trickier. Run a command like this and watch what occurs:
$ echo this || echo that && echo the opposite this the opposite
The primary echo command runs efficiently, so the second isn’t run (regular OR habits). The left facet of the AND (&&) was nonetheless run efficiently, so the fitting facet runs as nicely.