I have mentioned below cmd on top of the script
exec > >(tee -a "$log_file") 2>&1
# (all remaining script part here)
The shell script is user interactive, so I want the inputs given by user are also to be redirected in same file. How this can be achieved?
scriptutility. – Kusalananda Apr 08 '21 at 06:41scriptutility, if it's not already installed, then runscript -c ./myshellscript.sh(wheremyshellscript.shis the name of your script). You would not need theexeccommand in the script. – Kusalananda Apr 08 '21 at 07:18scriptexample). – fra-san Apr 08 '21 at 08:56