I've read (e.g. here: How do file descriptors work?) that to use file descriptors 3 - 9 I need to open them first. Trying to use them without it produces an error:
function f()
{
echo hi 1>&3
}
f
Output:
bash: 3: Bad file descriptor
However, if I redirect it when calling the function everything seems to work fine:
f 3>&1
Output:
hi
So do I need to open file descriptors or not?