Bash exec explanation

Viewed 108

What does this line from a bash script do? Specifically the exec redirection.

exec > >(tee -i file)

Note the spaces between the >

1 Answers

It changes the current shell's stdout so that it outputs both to the file named file and to the previous stdout (which was presumably a terminal window).

It does not modify stderr, so not all output will be logged.

In general, exec with a set of redirections and no executable applies the redirections to the current shell.

Related