you are viewing a single comment's thread
view the rest of the comments
[–] 20 points 5 months ago (1 child)

I know this is a meme and not GitHub, but I thought some people might like to learn that if you do please shutdown && thanks it won't say you're welcome if the shutdown failed

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 5 months ago (2 children)

    Wait, isn't it the other way around? I thought ; only executed the next command if the previous one succeeded, and && executed the next command regardless of exit status.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 11 points 5 months ago* (1 child)

    No, OP is correct, && only continues on exit 0. || For anything but zero, ; just chains another command.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 5 months ago (1 child)

    Ah yes you're right, had to look it up to see for myself. It's weird because i remember specifically changing some of my &&s for ; instead because i wanted it to not continue if exit wasn't zero, but i must've misread it at the time. Time to change it back i guess lol.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 5 months ago

    It makes more sense if you think of semicolons like other programming languages like Java and C use it.

    foo();
    bar();
    

    But those languages allow foo(); bar(); as well. Then && works like a normal short circuited expression (with side effects).

  • source
  • parent