Port to POSIX shell

So that it can be used on systems without bash / where bash is not used
for startup because of speed.
Why does this function body need to be inside a subshell?