The command is definitely running in zsh
For example, I can echo various variables set by the shell and they will work
as expected.
BEGIN {
"echo $ZSH_EXECUTION_STRING" | getline executionstring
"echo $ZSH_EVAL_CONTEXT" | getline zshevalcontext
"echo $ZSH_VERSION" | getline zshversion
print "Execution String =" , executionstring
print "Zsh Eval Context =", zshevalcontext
print "Zsh Version =", zshversion
}
❯ gawk -f script.awk
Execution String = echo $ZSH_EXECUTION_STRING
Zsh Eval Context = cmdarg
Zsh Version = 5.9
==========
The manpage for sh in my machine says :-
sh is a POSIX-compliant command interpreter (shell).It is implemented
by re-execing as either bash(1), dash(1), or zsh(1) as determined by the
symbolic link located at /private/var/select/sh.If
/private/var/select/sh does not exist or does not point to a valid shell,
sh will use one of the supported shells.
And the link is pointing correctly
❯ readlink /private/var/select/sh
/bin/zsh
<snip>