exec 6>&1
will copy file descriptor 1 onto 6.
But how can I copy both stderr and stdout (1 and 2)to file descriptor 6 ?
Redirect stdout to 6 and stderr to stdout (so it will be further redirected to 6):
command >&6 2>&1
I don't think you can redirect two files descriptors in one, but you can use two files descriptors pointing to one file
exec 1>./all.txt
exec 2>./all.txt
bash
allows the special case of &> ./all.txt
to redirect stdout and stderr at the same time.
Try with:
command &>&6
&>filename
# Redirect both stdout and stderr to file "filename."
# This operator is now functional, as of Bash 4, final release.
M>&N
# "M" is a file descriptor, which defaults to 1, if not set.
# "N" is another file descriptor.
&>
does not allow you to duplicate two file descriptors into one; it only allows you to redirect to a file.