Your guess is right.
exec >filename
command redirects stdout
to the designated file. This sends all command output that would normally go to stdout
to that file.
command &> filename
redirects both the stdout
and the stderr
of command to filename.
Actually, command &>file
is another form of command > file 2>&1
(not available in Bourne Shell prior to version 4, final release, or in the standard shell Debian Almquist shell used in Debian/Ubuntu):
What does the &
charachter do? Very well explained here:
In shells derived from csh (the C shell), the syntax instead appends
the &
(ampersand) character to the redirect characters, thus achieving
a similar result. The reason for this is to distinguish between a file
named '1' and stdout, i.e. cat file 2>1
vs cat file 2>&1
. In the
first case, stderr is redirected to a file named '1' and in the
second, stderr is redirected to stdout.
Read more on I/O redirection here:
http://www.tldp.org/LDP/abs/html/io-redirection.html
http://www.tldp.org/LDP/intro-linux/html/sect_05_02.html#sect_05_02_01