• Victor@lemmy.world
    link
    fedilink
    arrow-up
    33
    ·
    1 month ago

    Probably a good idea to enable the nounset shell option when shipping commercial-grade install scripts. 😅

    • fruitcantfly@programming.dev
      link
      fedilink
      arrow-up
      7
      ·
      edit-2
      1 month ago

      That really ought to have been the default behavior. Opting out only takes one or two extra characters. Well, three or four if you don’t habitually bracket your variable names, which you should probably be doing anyways

    • OwOarchist@pawb.social
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 month ago

      Or just include the trailing slash in $STEAMROOT, so that if the variable is empty, it will evaluate to rm -rf "" and do nothing.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        1 month ago

        That seems like a more error-prone solution than the shell option. That would make it evaluate to rm -rf * which would probably delete your home directory, I’m guessing. And also put the burden of knowing the slash needs to be included on something completely disconnected from the expression. Nah, don’t do it like that.