if elseif fi


 
Thread Tools Search this Thread
Operating Systems Linux if elseif fi
# 1  
Old 12-29-2010
if elseif fi

Hi all,

This is my first post in this forum, can i request you to guide, where i am going wrong with the error below.

34: Syntax error: "fi" unexpected (expecting "then")

Code:
#!/bin/sh 
argCount=0
mysql_path=$USER_INSTALL_DIR$
for i in $*; do 
/A argCount+=1
done
if [ "${argCount}" -eq "0" ];then
echo "There are no rejected records." >> /opt/oracle/Public/test.txt
fi
if [ $argCount -eq 0 ];
then
showDEFAULTUsage $0$;
fi
if [[ ${1} = "MySQL" ]]; then 
echo "MySQL"
elif
[[ $argCount -ne 9 ]]; then
[[ showMYSQLUsage $0 ]]
elif
[[ mysqlDBMIGRATORSCRIPT $0$ $1 $2 $3 $4 $5 $6 $7 $8 $9 ]]
fi
mysqlDBMIGRATORSCRIPT
mysqldump -u $2 -p$3 -h$8 $4 > $mysql_path$/$4.sql
EOF
showDEFAULTUsage
echo [USAGE]: $~1 "DB TYPE(mysql|oracle|sqlserver|sybase)" "DB PARAMS"
EOF
showMYSQLUsage
echo [USAGE]: $~1 "DB TYPE" "SOURCE USER NAME" "SOURCE USER PWD" "SOURCE DB SCHEMA NAME" "TARGET USER NAME" "TARGET USER PWD" "TARGET DB SCHEMA NAME" "SOURCE HOST" "TARGET HOST"
EOF
EOF

# 2  
Old 12-29-2010
From the bash manpage:
Code:
 if list; then list; [ elif list; then list; ] ... [ else list; ] fi

These lines of code dont seem to have the "then list" expression...
Code:
elif
[[ mysqlDBMIGRATORSCRIPT $0$ $1 $2 $3 $4 $5 $6 $7 $8 $9 ]]
fi

# 3  
Old 12-29-2010
ok i will modify on those and get back to you

Thanks guys
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. AIX

Elseif & for condition in AIX

I'm using the below statements in my script if && then sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql elif then for idx in 0 1 2 3 4 5 6 7 do sqlplus sysadm/abcdefgh12@${dbarr} @/u1/scripts/ResetPswd.sql done else exit fi It give me... (5 Replies)
Discussion started by: Pandee
5 Replies

2. Programming

Problem with IF ELSEIF and GOTO statements in FORTRAN

Hi I am reading a book about Fortran 90 and I write the following code, to test my understanding of the first chapter. I have a problem with the last section of the code with deals with an IF, ELSEIF, and GOTO statements. Here is my Code PROGRAM sim ! This code is used to solve two... (3 Replies)
Discussion started by: faizlo
3 Replies

3. UNIX for Dummies Questions & Answers

If Then ElseIf Script - Confusion Around Expression's Syntax

Hello, I am relatively new to UNIX scripting and am learning a lot. I have already tried several searches on this website and have tried various syntax options suggested to no avail. I am obviously not writing the script correctly. I really do appreciate any and all the help. Below is an... (8 Replies)
Discussion started by: dqrgk0
8 Replies

4. Shell Programming and Scripting

if elseif fi

Hi, Ihave shifted this thread which i posted in linux forum to here if i am fault please correct me. When i excute this below script i am getting the follwing error can any one please look into it for persual. ./sample_oracle_tradescope.sh: 25: showDEFAULTUsage: not found ... (6 Replies)
Discussion started by: oracle_coorgi
6 Replies

5. Shell Programming and Scripting

elseif in csh

I have been using the if statement in csh like this if ( $opt1 == 1 ) then ..... elseif ( $opt2 == 1 ) then ...... endif Seems to work, but got Badly placed ()'s. When I used a space in the elseif, a space between the 'else' and the 'if' it worked (0 Replies)
Discussion started by: kristinu
0 Replies

6. Shell Programming and Scripting

Awk if elseif syntax error

Below is the code. nawk -F "|" 'FNR==NR{a=$3 OFS $4 OFS $5 OFS $6;next} {\ if ($5 in a)\ {print $1,"ABC",$5,"I",a, $2,$3,$4 OFS OFS OFS OFS OFS OFS OFS OFS $2"-"$3"-"$4} ; \ elseif ($5=="g")\ print $1,"ABC",$5,"I",$5 OFS OFS OFS OFS $2,$3,$4 OFS OFS OFS OFS OFS... (8 Replies)
Discussion started by: pinnacle
8 Replies
Login or Register to Ask a Question