Collection of sh, AWK scripts with an exhaustive description of dependencies
and POSIX compliance; a few bash scripts too, when arrays are needed.
Newlines in paths won't be handled until POSIX adds find -print0, xargs -0,
sed -Z, read -d, etc... (which is never ever, cf [1] [2] [3] [4] [5]).
local/typeset is required because it is an important usability feature and
quite portable as long as you don't use `local var` and expect a specified
behaviour (cf [6]) or use unquoted arguments.
The need for an initial `readlink -f` to source util.sh in every script is
eliminated by using SH_LIB_DIR as environment variable containing its location
(defaulting to ~/bin/).
Fortunately, the next POSIX standard finally has a fix [7].
--------------------------------------------------------------------------------
As an addendum, the lesson to be taken from all of this is that POSIX sh
scripting is very powerful but insanely brain damaged if you want to stay
portable, and just a bit less obscene if you choose to tie yourself to a more
"complete" implementation like ksh/zsh/bash and a specific OS (e.g. to get
access to util-linux).
For your sanity, please use something like Python or Perl (or Tcl or Lisp, if
you have taste and don't care about their lack of ubiquity).
[1] https://austingroupbugs.net/view.php?id=243
[2] https://austingroupbugs.net/view.php?id=244
[3] https://austingroupbugs.net/view.php?id=245
[4] https://austingroupbugs.net/view.php?id=247
[5] https://austingroupbugs.net/view.php?id=251
[6] https://austingroupbugs.net/view.php?id=767
[7] https://austingroupbugs.net/view.php?id=1457