Robert Elz <k...@munnari.oz.au> wrote: > When you redirect standard output of a built-in command, the > existing standard output needs to be moved somewhere else (saved) > before the new one can be opened (dup'd in this case). 13 is > the next available fd
I see, thanks. It looks like the selection of fd 12 happens in jobs.c, setjobctl, #184 / redir.c #588 ff. I gather the intention is to pick an fd that's above 10, because users might want to do other manual redirections ("exec 3<whatever") and are likely to choose small fd numbers. So 13 really isn't the next _available_ fd (which would be 3), but "the next available 'high' fd we expect not to clash with any of the users' fds". Do you want me to send-pr the redirection to fds 12/13? -Jan