• unalivejoy@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    19 days ago

    All you need to do is set -e at the start of the script to stop on a non-0 exit code. And quote variables to prevent globbing.

    • flying_sheep@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      19 days ago

      Oh you sweet summer child.

      If you don’t use pipes or command substitutions, set -e gets you a fair part of the way there.

      If you’re interested, I can look up the rest of the arcane incantations necessary.

      • unalivejoy@lemm.ee
        link
        fedilink
        English
        arrow-up
        0
        ·
        19 days ago

        Here’s a neat tidbit. Using curl without -f --fail will make non-2xx status codes return success, so set -e won’t help there.