The script below can export ORACLE_HOME without any issues with commented lines. If would first cat oratab file, then trim it out, so that we get "#" at the start of the line. Then it would remove any lines with "#" as the start of the line. This would remove any commented out lines. And then it will get you the second column out, which is ORACLE_HOME.
ORACLE_HOME=`cat /etc/oratab| sed 's/^ *\(.*\) *$/\1/' |grep -v ^\# |grep -w "$SID"|awk -F: '{print $2}'`
-- Vish.
Monday, October 27, 2008
Subscribe to:
Posts (Atom)