'end of file' unexpected

HELP PLEASE!!

I am running this script, and i keep getting the error 'end of file' unexpected. I know that usually means parenthesis or whatever is out of place but i cant find anything!! I am new to scripting and i put some "print" staements in and it is not getting past the first IF statment i dont think. Here is the script. Thanks in advance

#!/bin/sh
echo "Please enter a station: \c"
read station
echo "Please enter the desired timestamp: \c"
read timestamp
cp PBLplot.pro $station/$timestamp
cd $station/$timestamp/
echo "Would you like to plot (1) 4panel with one var per map or (2) 4panel all vars per map: \c"
read choice
echo "$choice"
if "$choice" -eq 1
then
   echo "Please enter temperature variable (Skin, Tmpc, T10m, T20m, Dwpc, Ts01, Ts02): \c"
   read temperature
   echo "Please enter flux variable (Sens, Soil, Latn, Snof, Rdwn, Fupf, Sped): \c"
   read fluxvar
   echo "Please enter boundary layer variable (Hpbl, Fclc, Zlcl, Thbr, Shbr, Tdir, Tspd): \c"
   read bl
   echo "Please enter solar radiation variable (Sold, Solu, Atmr, Terr, Netr, Sumr, Bown): \c"
   read solarrad
   echo "Do you want to save this plot?: \c"
   read saveplot
   echo "Enter a file name (no extensions please): \c"
   read filename
   idl<<EOF
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $temperature
   $fluxvar
   $bl
   $solarrad
   $saveplot
   $filename
   exit
   EOF
elif "$choice" -eq 2
then
   echo "Do you want to save this plot?: \c"
   read saveplot
   echo "Enter a file name (no extensions please): \c"
   read filename
   idl<<EOF   
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $saveplot
   $filename
   exit
   EOF
fi
   
echo "continue" 
   
rm PBLplot.pro 

#

The syntax of the if statement is not proper, replace the if and elif statement with:

if [ "$choice" -eq 1 ]

and

elif [ "$choice" -eq 2 ]

Beware of the spaces around the brackets.

Please place your code between code tags next time to improve readability. Select your code and click on the # symbol above the editing window.

Regards

Thank you for the quick response, you can see now that i have changed the syntax, but am still getting the same error....any other suggestions?

#!/bin/sh

echo "Please enter a station: \c"
read station
echo "Please enter the desired timestamp: \c"
read timestamp

cp PBLplot.pro $station/$timestamp
cd $station/$timestamp/

echo "Would you like to plot (1) 4panel with one var per map or (2) 4panel all vars per map: \c"
read choice
echo "$choice"

if [ "$choice" -eq 1 ]
then
   echo "Please enter temperature variable (Skin, Tmpc, T10m, T20m, Dwpc, Ts01, Ts02): \c"
   read temperature
   echo "Please enter flux variable (Sens, Soil, Latn, Snof, Rdwn, Fupf, Sped): \c"
   read fluxvar
   echo "Please enter boundary layer variable (Hpbl, Fclc, Zlcl, Thbr, Shbr, Tdir, Tspd): \c"
   read bl
   echo "Please enter solar radiation variable (Sold, Solu, Atmr, Terr, Netr, Sumr, Bown): \c"
   read solarrad
   echo "Do you want to save this plot?: \c"
   read saveplot
   echo "Enter a file name (no extensions please): \c"
   read filename
   idl<<EOF
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $temperature
   $fluxvar
   $bl
   $solarrad
   $saveplot
   $filename
   exit
   EOF
elif [ "$choice" -eq 2 ]
then
   echo "Do you want to save this plot?: \c"
   read saveplot
   echo "Enter a file name (no extensions please): \c"
   read filename
   idl<<EOF   
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $saveplot
   $filename
   exit
   EOF
fi
   
echo "continue" 
   
rm PBLplot.pro  
   
#

And [ is actually a symlink (or alias) to "test". So you could also do :

if test "$choice" -eq 1

after trying both of these suggestions it still yields the same error.

Remove the spaces before EOF:

   idl<<EOF
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $temperature
   $fluxvar
   $bl
   $solarrad
   $saveplot
   $filename
   exit
EOF

Regards

You are my new best friend!!!!!!! Thank you so much. Have a great weekend!

Great, so what does that make me, your best enemy??

just kidding

:wink: