Explain the bash command “exec > >(tee $LOG_FILE) 2>&1”
问题 My intent was to have all the output of my bash script displayed on the console and logged to a file. Here is my script that works as expected. #!/bin/bash LOG_FILE="test_log.log" touch $LOG_FILE # output to console and to logfile exec > >(tee $LOG_FILE) 2>&1 echo "Starting command ls" ls -al echo "End of script" However I do not understand why it works that way. I expected to have exec >>(tee $LOG_FILE) 2>&1 work but it fails although exec >>$LOG_FILE 2>&1 indeed works. I could not find the