31 Ocak 2021 Pazar tarihinde Érico Nogueira <eric...@disroot.org> yazdı: > > #!/bin/sh > > fn() { > echo a >&3 > } > > b=`fn 3>&1 1>&4 4>&-` 4>&1
Not a bug, POSIX allows implementations to perform assignments before redirections in this case. To guarantee `4>&1' is in effect while `b=`fn 3>&1 1>&4 4>&-`' is being expanded, you should do: { b=`fn 3>&1 1>&4 4>&-`; } 4>&1 > While exploring similar issues, I found that > > fn() { > echo a >&3 > } > > echo `fn 3>&1 1>&4 4>&-` 4>&1 > > > also fails > Command substitutions are expanded before redirections are performed. -- Oğuz