Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another Syntax Error in BASH Shell

Status
Not open for further replies.

wak1967

Technical User
Feb 22, 2003
8
GB
Hi all

In the following script I am getting an error on the 'if' line. I'm guessing the problem is with the brackets. Any ideas?


if [ $db_status = "MOUNTED" -o $db_status = "OPEN" ]; then
#
# Get the archivelog-mode of the database
#
ARCHIVELOG=`sqlplus -s &quot;/ as sysdba&quot; <<EOF
set heading off
set feedback off
set verify off
select log_mode from v\\$database;
exit
EOF
`
 
Sorry, afetr a weekend looking at this script I'm going crazy!

the error was bash: [: too many arguments.

I also need to mention that the script ends with a 'fi'
 
Did you try placing the [tt]$db_status[/tt] in quotes ([tt]&quot;$db_status&quot;[/tt])? //Daniel
 
Hi Daniel

I tried the quotes without success. Then I changed db_status to DB_STATUS and it all works now, with or without the quotes. Must be case sensitive.

Many thanks for your time.

Wak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top