I tried to send out a summary yesterday, but for some reason it never made it to the list! I am glad though, as I received many more replies today with even more ways of obtaining my goal. I have had about 50 replies to this inquiry so I will not be listing any names, but here is the answer I liked the best... > It's not the case statement, it's the leading whitespace in the > here document terminator. In order to preserve the indentation > you have two choices. If the leading whitespace is all tabs you > can use '<<-' in place of '<<' - see the ksh manpage. Given your > script, I would assign the svrmgrl commands to a variable since > 3 of the 4 instances are identical. > > choice 1: > # leading whitespace must be TAB characters > svrmgrl <<-0xff > connect internal; > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate; > 0xff > > > choice 2: > export cmd='connect internal; > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate;' > > In the case statement: > echo $cmd | svrmgrl Again, Many Thanks to all who replied!!! You have been an invaluable resource!!! ---------------------------------------------- Edward W. Carr UNIX Systems Administrator Qwest Communications Broadband Services Inc. > -----Original Message----- > Sent: Wednesday, August 22, 2001 3:58 PM > To: SunManagers > Subject: KSH Script problems ... > > I need help from the KSH experts out there ... > > Why do I get the following error message: /export/home/oracle/bin/stopdb[31]: syntax error at line 33 : `<<' unmatched > > I can only assume it is because the command is in a case statement. > Any way around this, and still be able to use a case statement? > > Thanks for the help ... > > #!/bin/ksh > > # > # Log Script output to a file > # > > exec >> $0.log > > print "============== Start - $0: `date` ==============" > print " " > > # > # Setup the environment > # > > . menu.env > > # > # Test to see if user is ORACLE > # > > if [ `whoami` != 'oracle' ]; then > echo "ERROR: You must be oracle to execute!" > exit 99 > fi > > # > # Main Prog... > # > > case $1 in > bdwdev ) export ORACLE_SID=bdwdev > svrmgrl << 0xff > connect internal; > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate; > 0xff > ;; > webdev ) export ORACLE_SID=webdev > svrmgrl << 0xff > connect internal; > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate; > 0xff > ;; > WEBPROD ) export ORACLE_SID=WEBPROD > svrmgrl << 0xff > connect internal; > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate; > 0xff > ;; > all ) for dbase in bdwdev webdev WEBPROD; do> > export ORACLE_SID=$dbase > svrmgrl << 0xff > connect internal; > show parameter db_name > alter system check datafiles; > ALTER SYSTEM ARCHIVE LOG ALL; > shutdown immediate; > 0xff > done > ;; > * ) print "\n\n SCRIPT ERROR \n\n" > exit 2 > ;; > esac > > print " " > print "=============== End - $0: `date` ===============" > > ---------------------------------------------- > Edward W. Carr > UNIX Systems Administrator > Qwest Communications > Broadband Services Inc. >Received on Thu Aug 23 17:05:47 2001
This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:25:02 EDT