1. 6
  1. 7

    This feels like another one of those “my personal language preferences presented as fact” posts …

    1. 4

      The criticism of shell functions seems a bit harsh. The notion of reassigning to variable names is the way to go, and even better, assuming you are using bash or something more than bare bones POSIX sh, use local.

      render_sitemap() {
          local urls="$1"
          local base_url="$2"
          local date="$3"
      ...
      

      If you’re paranoid, use local -r.

      1. 1

        I think local is supported on pretty much any shell these days, including dash.

      2. 3

        Both uses of stat and date are not portable.

        1. 1

          not knowing how the stat command works is a shell sin?