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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats wrong with the if 1

Status
Not open for further replies.

scrsadmin

Technical User
May 3, 2004
62
US
Heres is my code. It says Syntax error at line 44 : `fi' is not expected. Why?

#-------------------------------
# Put file to imaging ftp server.
#-------------------------------
{
rrfile=/tmp/tf2tiff
export prod_a=tf2tiff-vm
export prod_b=btf2tiff-vm


TIPFUP=$( /usr/sbin/ping $prod_a -n 2|awk '/received/{print $4}' )
BTIPFUP=$( /usr/sbin/ping $prod_b -n 2|awk '/received/{print $4}' )

if [[ $TIPFUP = 2 || $BTIPFUP = 2 ]]

then
echo "A file2tif is on"

# test if prod_a is up and rrfile exist

if [[ $TIPFUP = 2 && -a $rrfile ]]

then

echo " TF2TIFF is on"
echo "file /tmp/tf2tiff exist"
rm -f $rrfile
# check flag file if exist then process files and delete flag file


elif [[ $BTIPFUP = 2 ]]
then
echo "BTF2TIFF is on"
touch $rrfile
# check flag file if exist then process files and delete flag file


else

# ftp to $TIPFUP
# check flag file if exist then process files and delete flag file


fi


else

# store files locally
# create flag file
echo "No tf2tiff"

fi

} >> ${LOG} 2>&1
 
You can't have an empty clause between then and fi or between else and fi


So put a null command in there:

[tt]...
else

# ftp to $TIPFUP
# check flag file if exist then process files and delete flag file
[red]:[/red]

fi


else
...[/tt]


HTH,

p5wizard
 
That did it thanks p5wizard.

I had looked and looked and couldn't figure out what was wrong.

Very much appreciated
 
p5wizard - I think your post deserves a star. I learnt something new today. Have a Star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top