cross-posted from: https://lemmy.ml/post/39334581

you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 8 months ago (1 child)

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

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 8 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 8 months 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.

  • source
  • parent