Amusingly, I apparently added these to scrap
https://github.com/shawwn/scrap many years ago.
I named them 1st, 2nd, 3rd, and 4th. So I guess I never needed to count to 5, but I'm still two ahead of Valve. https://www.youtube.com/watch?v=jpw2ebhTSKs
EDIT: Actually, I'd never committed 4th. It was just sitting here in my local scrap. So I guess I counted to three, realized at some later date I needed four, copied 3rd to 4th, then never committed.
Oh. Apparently I also have 'nth', which was exactly what I wanted:
> echo a b c d | nth 0 3
a d
The solution I came up with at the time:
#!/bin/bash
c=""
for n in "$@"
do
n=$((n+1))
args="${args}${c}\$$n"
c=', '
done
awk "{ print ${args}; }"
Nowadays I'd write it like:
awk "{ print $(echo "$@" | args math '1+{}' | replace '^' '$' | trim | joinlines ', '); }"
But I admit both are equally cryptic, and the former might even be more readable.