Skip to main content

exec and tee to the logfile.: explain thisthese bash commands

I saw this at the top of my bash script file.:

export LOGFILE=$LOGDIRECTORY/${SCRIPT_NAME}.log exec > >(tee $LOGFILE) exec 2>&1 

What does it do? What are two exec processes doing here? I can realize that keeping it like this, all the output of the execution of the script is piped to the $LOGFILE but I wanted to understand from the perspective of the exec statements.

exec and tee to the logfile. explain this bash commands

I saw this at the top of my bash script file.

export LOGFILE=$LOGDIRECTORY/${SCRIPT_NAME}.log exec > >(tee $LOGFILE) exec 2>&1 

What does it do? What are two exec processes doing here? I can realize that keeping it like this, all the output of the execution of the script is piped to the $LOGFILE but I wanted to understand from the perspective of the exec statements.

exec and tee to the logfile: explain these bash commands

I saw this at the top of my bash script file:

export LOGFILE=$LOGDIRECTORY/${SCRIPT_NAME}.log exec > >(tee $LOGFILE) exec 2>&1 

What does it do? What are two exec processes doing here? I realize that keeping it like this, all the output of the execution of the script is piped to $LOGFILE but I wanted to understand from the perspective of the exec statements.

Tweeted twitter.com/StackUnix/status/735286442063212545
Source Link

exec and tee to the logfile. explain this bash commands

I saw this at the top of my bash script file.

export LOGFILE=$LOGDIRECTORY/${SCRIPT_NAME}.log exec > >(tee $LOGFILE) exec 2>&1 

What does it do? What are two exec processes doing here? I can realize that keeping it like this, all the output of the execution of the script is piped to the $LOGFILE but I wanted to understand from the perspective of the exec statements.