The following script runs with the -e
option, so it will exit if any of the commands in it fail:
#!/bin/sh -e
command1 #script should fail if command1 fails
command2 #script should NOT fail if command2 fails
command3 #script should fail if command3 fails
How can I make the script not to fail on command2
?
command1
command2 || true
command3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With