On Fri, Jan 10, 2025, at 7:50 PM, Christoph Anton Mitterer via austin-group-l
at The Open Group wrote:
> bash/dash seem to pass on the redirected FDs, but I found at least on
> shell wich doesn’t namely, mksh
Neither do ksh93u+ 2012-08-01, ksh93u+m/1.0.10 2024-08-01 (except
in posix mode), and OpenBSD 7.6 pdksh.
% /bin/ksh -c 'exec 3>&1; sh -c "echo hi >&3"'
sh: 3: Bad file descriptor
% /opt/local/bin/ksh -c 'exec 3>&1; sh -c "echo hi >&3"'
sh: 3: Bad file descriptor
% /opt/local/bin/ksh --posix -c 'exec 3>&1; sh -c "echo hi >&3"'
hi
% oksh -c 'exec 3>&1; sh -c "echo hi >&3"'
sh: 3: Bad file descriptor
> Or could the behaviour [...] be changed?
That is up to the shell implementors, of course.
--
vq