$SQLPLUS -L $DBCONNECT_STRING <<-! | tee -a $logFile
whenever sqlerror exit sql.sqlcode||sqlerrm;
...
!
HereDoc 结束符如果为EOF或其他字符不能有任何其他字符,也就意味着行首不能有任何空格,缩进等。如果使用缩进可以用以上方式。管道可以实现既输出到屏幕也输出到log文件。
tee - Read from standard input and write to standard output and files.
command1 | tee FILE | command2
command1 > FILE
command1 | command2