The UNIX and Linux Forums  
Helloやアメリカ合衆国へようこそ! UNIXおよびLinuxフォーラム!訪問し、当社のグローバルコミュニティに参加いただきありがとうございます。

Go Back   UNIXおよびLinuxフォーラム > トップフォーラム > シェルプログラミングとスクリプティング
Googleのunix.com



シェルプログラミングとスクリプティング KSH 、 CSH 、 shに、 bashの、はPerl 、 PHPは、削除するsed 、 Awkの、他のシェルスクリプトやシェルスクリプト言語についての質問の投稿はこちら。

その他のUNIXおよびLinuxフォーラムトピックは参考にすること
スレッド スレッドスターター フォーラム 返信 最後の投稿
ファイル'予想外の'末端 srisreeku シェルプログラミングとスクリプティング 1 2008年4月28日 03:39午後
予期しないファイルの終わり naveeng.81 シェルプログラミングとスクリプティング 1 2008年3月11日 06:43午前
予期しないファイルの終わり dineshr85 シェルプログラミングとスクリプティング 2 2007年10月15日 03:47午前
ファイル'予想外の'末端 abhijeetkul シェルプログラミングとスクリプティング 4 2006年4月10日 07:42午前
gunzipを:予期しないファイルの終わり ドリー UNIXのダミー質問と回答のため 1 2002年9月26日 06:34午前

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek を搭載 Powered by Google
 
LinkBack スレッドツール このスレッドを検索 スレッドを評価 表示モード
  #1固定リンク)  
Old 2008年10月11日
weatherman0516 weatherman0516 is offline
登録ユーザー
  
 

参加日: 2008年10月
投稿数: 4
ファイル'予想外の'末端

してください! !

私はこのスクリプトを実行して、ファイルI '予想外のエラー'末端てくるんだ。私は、通常括弧手段か場違いカントですが、私は知っているものを見つける!私のスクリプトと私はいくつかの"印刷"でstaementsに置き、それを過去の文私は、最初のIF dontしていないことに新しいだと思う。ここでは、スクリプトです。事前に感謝

コード:
#!/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

編集Franklin52で最終; 2008年10月11日に 01:10午後..理由:コードのタグを追加する
  #2固定リンク)  
Old 2008年10月11日
Franklin52 Franklin52 is online now Forum Staff  
モデレータ
  
 

参加日: 2007年2月
投稿数:4308
if文は、適切ではありませんが、交換するとの構文は、 elif文の場合:

コード:
if [ "$choice" -eq 1 ]

and

elif [ "$choice" -eq 2 ]
ブラケットの周りのスペースに注意。

以下のコードをタグの間に次の時間、読みやすさを改善するようにコードを配置します。を選択してコードをクリックし、 [編集ウィンドウの上にある#記号。

よろしく
  #3固定リンク)  
Old 2008年10月11日
weatherman0516 weatherman0516 is offline
登録ユーザー
  
 

参加日: 2008年10月
投稿数: 4
の迅速な応答をしていただきありがとうございます、今では私は、構文を変更しているが、まだ他の提案を見ることができます....と同様のエラーを取得するのですか?

コード:
#!/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固定リンク)  
Old 2008年10月11日
otheus's Avatar
otheus otheus is offline Forum Staff  
モデレータ翼モード
  
 

参加日: 2007年2月
場所:インスブルック、オーストリア
投稿数: 1,886
と[ "テスト"に、実際にはシンボリックリンク(またはエイリアス)です。そのためにも行うこと:

コード:
if test "$choice" -eq 1
  #5固定リンク)  
Old 2008年10月11日
weatherman0516 weatherman0516 is offline
登録ユーザー
  
 

参加日: 2008年10月
投稿数: 4
両方に同じエラーの利回りは、これらの提案を目指しています。
  #6固定リンク)  
Old 2008年10月11日
Franklin52 Franklin52 is online now Forum Staff  
モデレータ
  
 

参加日: 2007年2月
投稿数:4308
前のスペースを削除 EOFを

コード:
   idl<<EOF
   .compile PBLplot.pro
   PBL
   $timestamp
   $choice
   $temperature
   $fluxvar
   $bl
   $solarrad
   $saveplot
   $filename
   exit
EOF
よろしく
  #7固定リンク)  
Old 2008年10月11日
weatherman0516 weatherman0516 is offline
登録ユーザー
  
 

参加日: 2008年10月
投稿数: 4
あなたは私の最高の新しい友達!!!!!!!どうもありがとう。素晴らしい週末を!
Closed Thread

ブックマーク

スレッドツール このスレッドを検索
このスレッドを検索

高度な検索
表示モード このスレッド
このスレッド

投稿ルール
あなた ことができない。 新しいスレッドを投稿
あなた ことができない。 返信の投稿
あなた ことができない。 添付ファイルの投稿
あなた ことができない。 自分の投稿を編集

BBコード なる 〜の上に
スマイリー なる 〜の上に
[イメージ] コードは 〜の上に
HTMLコードは、 オフ
トラックバック なる 〜の上に
ピングバック なる 〜の上に
Refbacks なる 〜の上に




すべてGMT -4です。現在の時刻は 02:44午後


提供: vBulletin、著作権© 2000 - 2006、Jelsoft企業株式会社。言語翻訳による電源
vBCredits v1.4著作権© 2007 - 2008 、 PixelFXスタジオ
は、 UNIXおよびLinuxフォーラムのコンテンツ著作権© 1993 〜 2009 。すべての権利を管理しReserved.Ad RedTyger

コンテンツ関連のURLで vBSEO 3.2.0