Sponsored Content
Full Discussion: if elseif fi
Top Forums Shell Programming and Scripting if elseif fi Post 302484212 by oracle_coorgi on Thursday 30th of December 2010 06:41:42 AM
Old 12-30-2010
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.

Code:
 
./sample_oracle_tradescope.sh: 25: showDEFAULTUsage: not found
[: 36: =: unexpected operator
[: 36: Illegal number: 0$
[: 36: oracleDBMIGRATORSCRIPT: unexpected operator
./sample_oracle_tradescope.sh: 38: oracleDBMIGRATORSCRIPT: not found
./sample_oracle_tradescope.sh: 39: exp: not found
./sample_oracle_tradescope.sh: 40: Syntax error: "(" unexpected

Code:
#!/bin/sh 
argCount=0
#sqlserver_path=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Backup/
mysql_path=$USER_INSTALL_DIR$
#for %%i in ($*); do /A argCount+=1
#if %argCount% EQU 0 (
# call :showDEFAULTUsage %0%
# goto:_EOF
#)
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 = Oracle ]
then 
echo "Oracle"
elif
[ $argCount$ -ne 9 ]
then
[ showORACLEUsage $0 ]
else
[ oracleDBMIGRATORSCRIPT $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 ]
fi
oracleDBMIGRATORSCRIPT
exp 'system/$2@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=$3)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=$4)))' file=$8.exp owner=$8 consistent=y statistics=none log=/export_db_$8.log
echo CONNECT system/$5@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=$6)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=$7))) >$~1.tmp
echo drop user $9 cascade;>>$~1.tmp
echo create user $9 identified by $9; >>$~1.tmp
echo grant all privileges to $9; >>$~1.tmp
echo EXIT; >>$~1.tmp
sqlplus /nolog @$~1.tmp
imp 'system/$5@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=$6)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=$7)))' file=$8.exp log=/import_db_$9.log fromuser=$8 touser=$9
EOF
showDEFAULTUsage
echo [USAGE]: $~1 "DB TYPE(mysql|oracle|sqlserver|sybase)" "DB PARAMS"
EOF
showORACLEUsage
echo [USAGE]: $~1 "DB TYPE" "SOURCE DB SYSTEM PWD" "SOURCE DB HOST" "SOURCE DB SID" "TARGET DB SYSTEM PWD" "TARGET DB HOST" "TARGET DB SID" "SOURCE SCHEMA" "TARGET SCHEMA"
EOF
EOF

 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. Linux

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") #!/bin/sh argCount=0 mysql_path=$USER_INSTALL_DIR$ for i in $*; do /A argCount+=1 done if ;then echo... (2 Replies)
Discussion started by: oracle_coorgi
2 Replies

4. 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

5. 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

6. 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
MSSQL_NUM_FIELDS(3)													       MSSQL_NUM_FIELDS(3)

mssql_num_fields - Gets the number of fields in result

SYNOPSIS
int mssql_num_fields (resource $result) DESCRIPTION
mssql_num_fields(3) returns the number of fields in a result set. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). RETURN VALUES
Returns the number of fields, as an integer. EXAMPLES
Example #1 mssql_num_fields(3) example <?php // Connect to MSSQL and select the database $link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi'); mssql_select_db('php', $link); // Select some data from our database $data = mssql_query('SELECT [name], [age] FROM [php].[dbo].[persons]'); // Construct a table echo '<table border="1">'; $header = false; // Iterate through returned results while ($row = mssql_fetch_array($data)) { // Build the table header if (!$header) { echo '<thead>'; echo '<tr>'; for ($i = 1; ($i + 1) <= mssql_num_fields($data); ++$i) { echo '<td>' . ucfirst($row[$i]) . '</td>'; } echo '</tr>'; echo '</thead>'; echo '<tbody>'; $header = true; } // Build the row echo '<tr>'; foreach($row as $value) { echo '<td>' . $value . '</td>'; } echo '</tr>'; } // Close table echo '</tbody>'; echo '</table>'; // Clean up mssql_free_result($data); mssql_close($link); ?> SEE ALSO
mssql_query(3), mssql_fetch_field(3), mssql_num_rows(3). PHP Documentation Group MSSQL_NUM_FIELDS(3)
All times are GMT -4. The time now is 04:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy