Screen Output Needed on every execution

Hi ,

A shell script being executed by multiple user in a host, but i need the output of each user who executed the script
user should have screen output as well ...and unique log file name should generated on execution of script

is there anyway to get it

below file will overwrite on each execution, but i need to have a different unique log file generated on each execution
like
sh test.sh | tee Dev1.log

Insert user name, date/time, and/or PID into the file name to make it unique. Place it under a user's home directory. Assign sequential numbers.

1 Like

any sample code please

sh test.sh | tee "Dev1_$(whoami)_$(date +"%Y%m%d_%H%M%S").log"

Gladly. Hand me the silver spoon, please.
Try

tee    ~/LOGS/${USER}_$(date +"%Y%m%d%H%M%S")_$$_Dev1.log

here: :spoon:

1 Like