home *** CD-ROM | disk | FTP | other *** search
- :
- #
- # $Header: prtversion.sh,v 6.6 89/03/28 10:32:16 wbailey Exp $ prtversion.sh
- #
- #
- # prtversion.sh
- #
- # usage: prtversion.sh [-f filename] [-p pathname]
- #
- # prints the version number of the oracle utilities
- # prints the revision number from rcs header if it is a sh/csh script
- # prints error output when error is encountered
- #
- # option: -f prints the version numbers to the specified file instead of stdout
- # -p allows user to specify pathname of the bin directory instead of
- # $ORACLE_HOME/bin
- #
-
- # parse options and test for command error
- for i in "$-"
- do
- case $1 in
- "-f") shift;
- case $1 in
- "") echo "$0: missing filename";
- exit 1;;
- *) FILENAME=$1;
- TRASH="/dev/null";;
- esac
- shift;;
- "-p") shift;
- case $1 in
- "") echo "$0: missing pathname";
- exit 1;;
- *) BINHOME=$1;;
- esac
- shift;;
- -*) echo "$0: bad option";
- exit 1;;
- "") break ;;
- *) echo "$0: bad argument";
- exit 1;;
- esac
- done
-
- # set up abbreviations; modify or add UGROUPxxx for new utilities
- BINHOME=${BINHOME-$ORACLE_HOME/bin}
- FILENAME=${FILENAME-"/dev/tty"}
- TMP=tmp$$
- TMPFILE=TMP$$
- TRASH=${TRASH-"/dev/tty"}
-
- UGROUPI="crt exp imp odl convert generate runform pcc rpf rpt sqlload \
- sqlplus sqldba runrep genrep dumprep loadrep printdef \
- dmm dmd"
-
- # remove temp files when interrupted
- trap "rm -f $TMP;if [ -f $TMPFILE ];then sort $TMPFILE > $FILENAME;fi;rm -f $TMPFILE; exit 1" 1 2 3 15
-
- if echo "\c"|grep "c" >/dev/null 2>&1
- then
- NFLAG="-n"
- CARFLG=""
- else
- NFLAG=""
- CARFLG="\c"
- fi
-
- echo $NFLAG "Looking for Version numbers..$CARFLG" > $TRASH
- echo $NFLAG ".$CARFLG" > $TRASH
-
- for FILE in $UGROUPI
- do
- if [ -f "$BINHOME/$FILE" ]
- then
- $BINHOME/$FILE < /dev/null > $TMP 2>&1
- VERS=`grep "Version" $TMP|sed 's/.* Version //
- s/ on.*$//'`
- echo "$FILE $VERS" >> $TMPFILE
- fi
- done
-
- rm -f $TMP
-
- #CHECK SQLFORMS
- VERS=`grep "runform" $TMPFILE|sed 's/runform //'`
- echo "sqlforms $VERS" >> $TMPFILE
-
- #CHECK ORAMAIL
- if [ -f "$BINHOME/oramail" ]
- then
- $BINHOME/oramail -\? < /dev/null > $TMP 2>&1
- VERS=`grep "Version" $TMP|sed 's/.* Version //
- s/ on.*$//'`
- echo "oramail $VERS" >> $TMPFILE
- rm -f $TMP
- fi
-
- #CHECK SQLREP
- if [ -f "$BINHOME/sqlrep" ]
- then
- $BINHOME/sqlrep -\? < /dev/null > $TMP 2>&1
- VERS=`grep "Version" $TMP|sed 's/.* Version //
- s/ on.*$//'`
- echo "sqlrep $VERS" >> $TMPFILE
- rm -f $TMP
- fi
-
- #CHECK SQLMENU
- if [ -f "$BINHOME/sqlmenu" ]
- then
- $BINHOME/sqlmenu -\? < /dev/null > $TMP 2>&1
- VERS=`grep "Version" $TMP|sed 's/.* Version //
- s/ on.*$//'`
- echo "sqlmenu $VERS" >> $TMPFILE
- rm -f $TMP
- fi
-
- echo "Done" > $TRASH
-
- echo $NFLAG "Sorting......$CARFLG" > $TRASH
-
- sort $TMPFILE > $TMP
-
- echo "Done" > $TRASH
-
- # print header
- echo > $FILENAME
- echo "Utility Version" >> $FILENAME
- echo "------- -------" >> $FILENAME
- cat $TMP >> $FILENAME
-
- # remove temp files
- rm -f $TMP $TMPFILE
-
- echo > $TRASH
- echo "Complete." > $TRASH
-
-
-