In a shell script i have
LOG=/my.log
exec 1>>$LOG
exec 2>&1
which redirects the output in shell script. Now the problem is in the following
LOG=/etc/security/aixpert/log/aixpert.log
exec 1>>$LOG
exec 2>&1
#some codes
print "I want this on cmd output not in log"
#I want rest of the output redirected to log as usual
How can i do this??
The key is to clone
stdoutgoing to the console to an arbitrary fd (I chose 3) before your redirect it to your log. Whenever you want to send output to the console you just redirect fd 1 back to fd 3 with>&3for that one command