On Sat, Jun 7, 2025, at 12:55 PM, Martin D Kealey wrote:
> However there might be some objections to relying on the printf built-in,
> since in theory Bash could be built without it, in which case I suggest:
>
> [...]
>
> +for (( m = n = argmax / ${#argmax} + 1 ; o = m & m-1 ; m = o )) do :; done
> +v=
> +for ((; m ; m >>= 1 )) do
> + v+=$v
> + (( n & m )) && v+=$argmax
It can also be built without arithmetic for loops and arithmetic
commands, so I don't think such objections would be reasonable.
--
vq