Demi
Demi

Reputation: 47

Bash exec explanation

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

exec > >(tee -i file)

Note the spaces between the >

Upvotes: 2

Views: 290

Answers (1)

rici
rici

Reputation: 241721

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.

Upvotes: 3

Related Questions