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.scriptutility, 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.scriptexample).