I'm calling sqlplus in a script & I want to tee the output to a logfile like this:
My problem is that the return code ($?) is from the tee command (which always works) & not from the sqlplus (which fails if I enter the wrong id or password). Can anyone suggest how I use the return code from sqlplus?
This works fine if I don't tee the output to a logfile.
Thanks, Chris
Code:
sqlplus -s my_id/my_pwd <<EOF | tee -a /tmp/xx
select * from v$instance;
exit
EOF
echo $?
My problem is that the return code ($?) is from the tee command (which always works) & not from the sqlplus (which fails if I enter the wrong id or password). Can anyone suggest how I use the return code from sqlplus?
This works fine if I don't tee the output to a logfile.
Thanks, Chris