everybody! I have a simple question.
What does this line do?
trap "exec 1>&6 6>&- ; cat $LOGFILE" 0
So far, I understand that I am moving the standard output to 6 (this variable hasn’t been declared before, so I assume that 6 is a variable created in this same line), then the ‘6>&-‘ is something I don’t really get… and the cat $LOGFILE shows the contents of the variable LOGFILE. Also, the 0 at the end is supposed to mean that at the end of the execution of my program, execute ‘exec 1>&6 6>&- ; cat $LOGFILE’ before exiting.
Thanks for the help in advance!
trap <command> 0means to execute<command>upon exit of the shellexec 1>&6means to redirect STDOUT (fd1) to fd6exec 6>&-means to close fd6