Check below:
===============================================
pid=`ps -ef | egrep "${sqlFile}" | awk '{print $2}'`
Returns the SQLPlus PID, filtering the "ps" command output using the SQL file, in this case: scriptDb.sql.
===============================================
===============================================
chk_err=`egrep -i 'ORA-|SP2-|TNS-|Usage' "${sqlplusOutputLog}" | wc -l`
Returns the number of Oracle errors in the log file pointed by: "${sqlplusOutputLog}".
This part:
egrep -i 'ORA-|SP2-|TNS-|Usage' "${sqlplusOutputLog}"
tries to find in the log file the words: "ORA-", "SP2-", "TNS-", "Usage" and if it finds, it prints to the screen, so the command "wc -l", count the lines returned.
===============================================
If you want you can execute each part of a pipe, as the next part will always do something with the previous command output.
About learning shell script, the following link seems to be a good start:
Unix shell scripting with ksh/bash
And if you have doubts, you can read the manual pages of each command, like: "man ps", there you will find all the command options and if you could not find the answer you are looking for, you can post a question here in the forum, we have excelent people here! =o)
I hope it helps!
Regards!