I have a simple tcpnotification receiver script that logs notifications. At first I just printed the notifications in terminal but then changed script so that notifications are logged in a file.But I would like the script to both print the logs in terminal and logged them to a file.while true; do    nc -l -p $portL >> ~/tcplog.log    #ipv6 version    #nc -6 -l -p $portL doneCan this be done in one command? I tried to add printf to nc -l -p $portL >> ~/tcplog.log but this just resulted in access denied. Also tried && but this resulted in notifications logged once in terminal then next time in logfile.
log script output to file and terminal at the same time
bash;tcp
Look at teenc -l -p $portL |tee -a ~/tcplog.logSee also man tee for more details