Redirecting file descriptor 3 with tee
Your guess is right. It's a rather nifty trick to swap standard output and standard error. To answer your questions:
- these redirections are captured by the shell so they apply to that portion of the pipeline (which is
sudo
). Thesudo
process itself will detect all the arguments and pass them along to its subcommand (rsync
) but the redirections have been captured and acted upon before that point:sudo
never sees them. - File handle 3 is not left hanging. It will be closed when the process ends.