• excess0680@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    10 hours ago

    Bash (specifically Bash, not POSIX sh) does have a keyword for functions (function), but it’s optional.

    • ulterno@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      9 hours ago

      Ooh nice.

      The optional bit messed it up, because even though I can make my scripts easier for me, other’s scripts won’t be.
      But then bash had to be usable with sh scripts, so I get it.

      • excess0680@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        Right. It’s optional so that Bash remains backwards compatible as a superset of POSIX sh. If you’re working with exclusively Bash, though, it’s nice to use as syntactic sugar if nothing else.