So I just gave this a spin, but it shows some promise.
There is oils.pub which provides osh, a posix compatible shell, which can be upgraded to ysh, which is a shell scripting language with data structures and more.
Since you can set the path to KAKOUNE_POSIX_SHELL, you can point it to osh instead.
KAKOUNE_POSIX_SHELL=/usr/bin/osh
kak # will now use osh
From there osh can be upgraded to use ysh within scripts
eval %sh {
shopt --set ysh:upgrade
var name = 'world'
var d = {parts: ["hello", name]}
echo "echo $[d.parts[0]]" # Will print hello, [1] prints name
}
That surprises me. I briefly tried Oil once a couple of years ago (it advertised better error messages and compatibility warnings that bash or dash) and found an issue with printf formatting that was quickly resolved — my understanding is they take bash compatibility quite seriously, and although the list of differences between bash’s defaults and POSIX is quite long, I don’t think most of those would affect Kakoune scripts.
If you can figure out why grep and make break, I’m sure they’d be interested in a bug report!