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

Exit traps for cleanup are a good idea in any case. Scripts can be killed by signals and whatnot as well.

I'm not sure what scenario you're imagining with your other concern. This does what you would expect:

    set -o errexit
    if [ -f somefile ]
    then
        echo "File exists."
    else
        echo "File does not exist."
    fi


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

Search: