• juipeltje@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    4 hours ago

    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.

      • juipeltje@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        2 hours ago

        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.

        • JackbyDev@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          12 minutes 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).