Chain commands and ignore error

I want to run the command rm -rf lib && some command which removes the lib/ directory, then builds my project which gets outputted to lib/.

The rm will fail if lib/ doesn't exist and won't execute the second command. How can I format this such that it will wait until the first command is done before starting the second and will continue to the second even if there is an error.

1 Answer

Use a semi-colon (;) to separate the commands instead.

For more information see this Unix thread:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like