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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay