13
rated 0 times
[
13]
[
0]
/ answers: 1 / hits: 6233
/ 2 Years ago, sun, april 3, 2022, 5:43:03
So I have a script like this:
somecommad | grep --invert-match something
I'd like to be able to conditionally run a different command if somecommand
fails. Here's what I tried:
somecommand | grep --invert-match something || {
echo 'Oops'
}
But that didn't work (the grep
wasn't executed). What is the proper way to do this?
More From » command-line