Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Ah, you're correct about this:

    echo "hi" | grep "bye" ; echo $?
    1




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: