I am trying to get the current stdout redirection and have some problems.
I have a script that always runs with a stdout redirect, i.e.
myscript.sh > /tmp/output.log
In myscript.sh, I need to find out to which file it is being output.
I am trying currently (not working):
logfile=$(readlink -f /proc/self/fd/1)
This is, for example, the output of logfile = / tmp / sflq.r3f. I need to find instead that it will be /tmp/output.log
Is it possible?
I use the korn shell if that matters ...
Thank!
source
share