Comment

Comment by hibbelig

I have recently written

    if some_command 1>/dev/null 2>/dev/null; then
        : # A-OK
    else
        here_is_the_code_i_actually_needed
    fi
And it leaves me wondering if there is a way to “negate” the exit status of a command...

(The command was “docker volume inspect VOLUME”, and in one place in my script I had to do things when the volume existed, and in other places I had to do things when the volume did not exist...)

parent hibbelig 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton