people always forget about the humble printf in shell
for example, imagine you want to some operation like sort uniq over space separated values in a string (traditional way to do arrays besides set —): instead of echo into IFS mangling etc consider:
printf ‘%s\n’ $VARS | …
want = pairs? printf ‘%s=%s\n’
and so on

@toast it’s cool but has a bunch of pitfalls if you’re not careful

i.e. people using printf and letting the format-string be user controlled

thankfully -v can only be the first argument, so you can’t accidentally let an attacker write to an arbitrary variable… rare case when the posix parameter order actually helps

(do note: i’m in the 0.1% of shell scripters who even consider it to be a “security boundary” of any sort because of httpsh, so i’m firmly an outlier and i shoudl not have been counted)

@domi yeah I write scripts for myself and I wouldn’t do that so it’s clearly fine :^)
if you run my scripts you should be ready for horrible things to happen (me living in your walls)

@toast after reading a few of your blogposts about POSIX stuffs i think you’re one of the 5 people where i would even consider running the shell script as-is without reimplementing it from the ground up

sometimes it’s just about the code shape, really. there aren’t many people who write shell in a way which makes it look nice