Anji
January 9, 2008, 3:37am
1
Hi All,
While I am trying to run below code I Am getting the exception like
./abs.sh: line 102: syntax error near unexpected token `then'
./abs.sh: line 102: ` then'
The Code Snippet is:
if[ "$file1" = "Sector.sql" || "$file1" = "Currency.sql" ] then
cat $file1 | sed -e "s/DB_NAME/${DBNAME}/g" > $LOG_DIR/$file1
$ISQL -U$USER -P$PASSWD -S$SERVERNAME < $LOG_DIR/$file1
echo "$LOG_DIR/$file1 file::::::::"
rm $LOG_DIR/$file
else
. $file1
fi
Can Anybody help me out to rectify that exception.
Thanks,
Anji
either u should give
if[ "$file1" = "Sector.sql" || "$file1" = "Currency.sql" ]; then
or
if[ "$file1" = "Sector.sql" || "$file1" = "Currency.sql" ]
then
Anji
January 9, 2008, 4:25am
3
Thank buddy,
I have tried that logic too...
but still I am getting the following Exception
Code Snippet:
if["$file1" = "Sector.sql" || "$file1" = "Currency.sql"]; then
cat $file1 | sed -e "s/DB_NAME/${DBNAME}/g" > $LOG_DIR/$file1
$ISQL -U$USER -P$PASSWD -S$SERVERNAME < $LOG_DIR/$file1
echo "$LOG_DIR/$file1 file::::::::"
rm $LOG_DIR/$file
else
. $file1
fi
Exception:
./abs.sh: line 101: syntax error near unexpected token `then'
./abs.sh: line 101: ` if["$file1" = "Sector.sql" || "$file1" = "Currency.sql"]; then '
if [ "$file1" = "Sector.sql" -o "$file1" = "Currency.sql" ]; then
Anji
January 9, 2008, 4:40am
5
Hi,
Thanks for your reply...
Sorry to say that
I have tried with the command which you have given.
but also I am getting the same error....
Code:
if[ "$file1" = "Sector.sql" -o "$file1" = "Currency.sql"]; then
cat $file1 | sed -e "s/DB_NAME/${DBNAME}/g" > $LOG_DIR/$file1
$ISQL -U$USER -P$PASSWD -S$SERVERNAME < $LOG_DIR/$file1
echo "$LOG_DIR/$file1 file::::::::"
rm $LOG_DIR/$file
else
. $file1
fi
Error:
./BatchJobs.sh: line 101: syntax error near unexpected token `then'
./BatchJobs.sh: line 101: ` if[ "$file1" = "Sector.sql" -o "$file1" = "Currency.sql"]; then'
Can u help me out plz....
---Anji
if[ "$file1" = "Sector.sql" -o "$file1" = "Currency.sql"]; then
if[ "$file1" = "Sector.sql" -o "$file1" = "Currency.sql" ]; then
Anji
January 9, 2008, 5:10am
7
I have given the space too
but I am getting the same error as above.....
This silly mistake making me lot of trouble
Can you plz help me out..........
thanks
anji
Try changing "if[" to 'if ["
Anji
January 9, 2008, 5:32am
9
Thanks Alot to everybody,research by own
Now I got it
The Code snippet which I have used is
if [[ $file1 = "Sector.sql" || "$file1" = "Currency.sql" ]]; then
Thank Again
Anji