The UNIX and Linux Forums  


Go Back   De Unix-en Linux Forum > Top Forums > Programmeren en Shell Scripting
.
google unix.com



Programmeren en Shell Scripting Post vragen over KSH, CSH, SH, Bash, Perl, PHP, sed, awk en andere shell scripts en shell scripting talen hier.

Meer UNIX en Linux Forum Onderwerpen Misschien vindt u Helpful
Draad Thread Starter Forum Antwoorden Last Post
'einde bestand' onverwachte srisreeku Programmeren en Shell Scripting 1 04-28-2008 03:39 PM
onverwacht einde van bestand naveeng.81 Programmeren en Shell Scripting 1 03-11-2008 06:43
onverwacht einde van bestand dineshr85 Programmeren en Shell Scripting 2 10-15-2007 03:47
'einde bestand' onverwachte abhijeetkul Programmeren en Shell Scripting 4 04-10-2006 07:42
Gunzip: onverwacht einde van bestand Dolly UNIX voor Dummies Questions & Answers 1 09-26-2002 06:34

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Zoeken in deze Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-11-2008
weatherman0516 weatherman0516 is offline
Geregistreerde gebruiker
  
 

Join Datum: oktober 2008
Posten: 4
'einde bestand' onverwachte

PLEASE HELP!

Ik ben draait dit script, en ik krijg steeds de foutmelding 'einde bestand' onverwacht. Ik weet dat betekent meestal haakjes of wat dan ook niet op zijn plaats, maar i cant vinden! Ik ben nieuw voor scripting en ik heb enkele "print" staements in en het is niet om voorbij de eerste if statement i dont think. Hier is het script. Thanks in advance


Code:
#!/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

#

Laatst gewijzigd door Franklin52; op 10.11.2008 01:10 PM.. Reden: toevoeging van code-tags
  #2 (permalink)  
Old 10-11-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Berichten: 4.342
De syntax van het if statement is niet goed, in de plaats indien en elif verklaring met:


Code:
if [ "$choice" -eq 1 ]

and

elif [ "$choice" -eq 2 ]

Pas op voor de ruimten rond de haakjes.

Gelieve uw code tussen code tags komende tijd om de leesbaarheid te verbeteren. Selecteer uw code in en klik op de #-symbool boven het bewerken venster.

Groeten
  #3 (permalink)  
Old 10-11-2008
weatherman0516 weatherman0516 is offline
Geregistreerde gebruiker
  
 

Join Datum: oktober 2008
Posten: 4
Dank u voor de snelle reactie, zie je nu dat ik zijn veranderd de syntax, maar ben nog steeds dezelfde fout .... alle andere suggesties?


Code:
#!/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  
   
#

  #4 (permalink)  
Old 10-11-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Locatie: Innsbruck, Oostenrijk
Berichten: 1891
En [is eigenlijk een symlink (of alias) op "test". Dus je zou ook kunnen doen:


Code:
if test "$choice" -eq 1

  #5 (permalink)  
Old 10-11-2008
weatherman0516 weatherman0516 is offline
Geregistreerde gebruiker
  
 

Join Datum: oktober 2008
Posten: 4
na proberen beide suggesties nog opbrengsten dezelfde fout.
  #6 (permalink)  
Old 10-11-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Berichten: 4.342
Verwijder de ruimten voor EOF:


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

Groeten
  #7 (permalink)  
Old 10-11-2008
weatherman0516 weatherman0516 is offline
Geregistreerde gebruiker
  
 

Join Datum: oktober 2008
Posten: 4
U bent mijn nieuwe beste vriend !!!!!!! Thank you so much. Have a great weekend!
Closed Thread

Bladwijzers

Thread Tools Zoeken in deze Thread
Zoeken in deze Thread:

Uitgebreid zoeken
Display Modes Beoordeel deze draad
Beoordeel deze draad:

Posting Regels
Jij mag niet Post Nieuwe threads
Jij mag niet na antwoorden
Jij mag niet post attachments
Jij mag niet bewerk uw berichten

BB code is Aan
Smilies zijn Aan
[IMG] code Aan
HTML-code is Uit
Trackbacks zijn Aan
Pingbacks zijn Aan
Refbacks zijn Aan




Alle tijden zijn GMT -4. Het is nu 11:42 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Vertalingen Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
De Unix-en Linux Forums Copyright © 1993-2009. Alle rechten Reserved.Ad Beheer door RedTyger

Content Relevante URL's door vBSEO 3.2.0