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"
...
This feels like another one of those “my personal language preferences presented as fact” posts …
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
.If you’re paranoid, use
local -r
.I think
local
is supported on pretty much any shell these days, includingdash
.Both uses of stat and date are not portable.
not knowing how the stat command works is a shell sin?