~q3cpma/scripts

A collection of scripts (POSIX sh and AWK) more or less maintained
Misc fixes and and add -ms=on to 7z
music_sync: actually handles -v
Improve vips.py

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~q3cpma/scripts
read/write
git@git.sr.ht:~q3cpma/scripts

You can also use your local clone with git send-email.

Collection of sh, AWK scripts with an exhaustive description of dependencies
and POSIX compliance; a few bash scripts too, when arrays are needed.

Handling newlines in paths won't be considered until the new POSIX comes out
(adds find -print0, xargs -0 and read -d, cf [1]). Still missing all the GNU
-z/-Z options for sed/grep/sort ([2]) and nullglob ([3]) but that should be
enough.

In addition to the latest POSIX, the following is required:
* local/typeset: an important usability feature and quite portable as long as
  you don't use `local var` and expect a specified behaviour, use unquoted
  arguments or parallel binding ([4]).

* mktemp -d: it can't be emulated and is quite portable in practice ([6]).
  A very simple implementation is available at [7] if needed.
  Note that POSIX m4 provides mkstemp if you only need temporary files.

* realpath: can be emulated with a pure sh contraption, but since it is needed
  to source the initial util.sh which contains said contraption...
  Fortunately, the next POSIX standard finally includes it ([5]).

* xargs -0, sed -E, find -iname -mindepth -maxdepth: all important and widely
  available on UNIX-like platforms.

This should roughly work on GNU, all BSDs and modern MacOS (Ventura/13 needed
for realpath).

--------------------------------------------------------------------------------

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 platform (e.g. to get
access to util-linux).

For your sanity, please use something like Python.


[1] https://austingroupbugs.net/view.php?id=243
[2] https://austingroupbugs.net/view.php?id=251
[3] https://austingroupbugs.net/view.php?id=247
[4] https://austingroupbugs.net/view.php?id=767
[5] https://austingroupbugs.net/view.php?id=1457
[6] https://austingroupbugs.net/view.php?id=1616
[7] https://git.sr.ht/~q3cpma/misc-tools