I am trying to write a piece of script execution. Logs should be displayed in the second tty, as well as written to the log file.
I can do this with a simple:
echo "Hello log" > /dev/tty2
echo "Hello log" > /var/log/my_logs
But it is very inconvenient. I could also redirect the echo to a specific location:
exec 1<>/var/log/my_logs
exec 2>&1
But how can I redirect STDOUT to both / dev / tty 2 and / var / log / my_logs at once?
Dejwi source
share