DEV Community

taijidude
taijidude

Posted on

1 1

A nice way to "combine" bash commands...

A Coworker today showed me a nice way to combine bash statements. Of course you can use a semicolon but if you use a double ampersand instead the second statement will only be executed if the first one didn't end with an error.

An example would be to check if a directory exists and if it does to copy some files into the dir.

Alt Text

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Retry later