1.第一个脚本
[oracle@rh64 ~]$ cat /u01/app/db11g/product/11.2.0/dbhome_1/install/utl/rootmacro.sh
#!/bin/sh
#
# $Id: rootmacro.sbs /st_buildtools_11.2.0/2 2012/11/06 02:43:45 rmallego Exp $
# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
#
# root.sh
#
# This script is intended to be run by root. The script contains
# all the product installation actions that require root privileges.
#
# IMPORTANT NOTES - READ BEFORE RUNNING SCRIPT
#
# (1) ORACLE_HOME and ORACLE_OWNER can be defined in user‘s
# environment to override default values defined in this script.
#
# (2) The environment variable LBIN (defined within the script) points to
# the default local bin area. Three executables will be moved there as
# part of this script execution.
#
# (3) Define (if desired) LOG variable to name of log file.
# -------->>>上面明白说明执行脚本之前ORACLE_HOME,ORACLE_OWNER一定要设置
AWK=/bin/awk
CAT=/bin/cat
CHGRP=/bin/chgrp
CHOWN=/bin/chown
CHMOD=/bin/chmod
CP=/bin/cp
DIFF=/usr/bin/diff
ECHO=echo
GREP=/bin/grep
LBIN=/usr/local/bin
MKDIR=/bin/mkdir
ORATABLOC=/etc
ORATAB=${ORATABLOC}/oratab
RM=/bin/rm
SED=/bin/sed
UNAME=/bin/uname
DATE=/bin/date
TEE=/usr/bin/tee
TMPORATB=/var/tmp/oratab$$
if [ `$UNAME` = "SunOS" ]
then
GREP=/usr/xpg4/bin/grep
fi
#
# conditional code execution starts. This set of code is invoked exactly once
# regardless of number of scripts that source rootmacro.sh
if [ "x$WAS_ROOTMACRO_CALL_MADE" = "x" ]; then
WAS_ROOTMACRO_CALL_MADE=YES ; export WAS_ROOTMACRO_CALL_MADE
LOG=${ORACLE_HOME}/install/root_`$UNAME -n`_`$DATE +%F_%H-%M-%S`.log ; export LOG
#
# Parse argument
#
while [ $# -gt 0 ]
do
case $1 in
-silent) SILENT_F=1;; # silent is set to true
-crshome) shift; CRSHOME=$1; export CRSHOME;; # CRSHOME is set
-bindir) shift; LBIN=$1; export LBIN;;
esac;
shift
done
#
# If LOG is not set, then send output to /dev/null
#
if [ "x${LOG}" = "x" -o "${LOG}" = "" ];then
LOG=/dev/null
else
$CP $LOG ${LOG}0 2>/dev/null
$ECHO "" > $LOG
fi
#
# Silent variable is set based on :
# if OUI_SILENT is true or if SILEN