5 ms·
I should have mentioned that 1. I am already using set -e 2. That `err` function has an `exit 1` as its last step, which forces the program to stop runn
by tieTYT 12y ago
I should have mentioned that
1. I am already using set -e
2. That `err` function has an `exit 1` as its last step,
which forces the program to stop running when combined with the first point.
> Now, on to your shell script example: in practice you'll never see an error because both grep and sed return true even when no matching or substitution is done.
That's not what I'm seeing:
> echo "hi" | grep "bye"
> echo $?
1
I'm typing that into my shell.
Thanks for the reply, it was very helpful.
- sigil 12y agoAh, you're correct about this: echo "hi" | grep "bye" ; echo $? 1