DEV Community

taijidude
taijidude

Posted on

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)