Also, do y’all call main() in the if block or do you just put the code you want to run in the if block?

  • grrgyle@slrpnk.net
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

    I’m not sure I’m following the implication. Name=main is for scripts primary, is it not?

    I’ve never thought to add more than one of these conditionals anyway…

    • bane_killgrind@slrpnk.net
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      So you might have a script that does stuff as a library, and it should get environment variables and other info from the calling script. You use the same script for doing one off stuff on different computers.

      So you make it do something slightly different or make it set it’s path and look into the current folder when you run it directly. This change in logic could be in a few points in the script.