![]() |
Helloやアメリカ合衆国へようこそ! UNIXおよびLinuxフォーラム!訪問し、当社のグローバルコミュニティに参加いただきありがとうございます。
|
|
Googleのunix.com
|
|||||||
| シェルプログラミングとスクリプティング KSH 、 CSH 、 shに、 bashの、はPerl 、 PHPは、削除するsed 、 Awkの、他のシェルスクリプトやシェルスクリプト言語についての質問の投稿はこちら。 |
その他のUNIXおよびLinuxフォーラムトピックは参考にすること
|
||||
| スレッド | スレッドスターター | フォーラム | 返信 | 最後の投稿 |
| ネストされたループ問題 | mmunir | シェルプログラミングとスクリプティング | 5 | 2008年7月4日 04:16午前 |
| 与えられたコードが無限ループになるとインクリメントは変数i | mrityunjay22 | シェルプログラミングとスクリプティング | 6 | 2007年12月26日 02:20午前 |
| ループ' 'をインクリメント日? | SunnyK | シェルプログラミングとスクリプティング | 4 | 2007年10月30日 06:12午前 |
| whileループのネストされた変数の場合 | geass | シェルプログラミングとスクリプティング | 6 | 2007年3月26日 07:09午後 |
| ネストされたループ | chinog | シェルプログラミングとスクリプティング | 5 | 2005年4月20日 11:45午前 |
![]() |
|
|
LinkBack | スレッドツール | このスレッドを検索 | スレッドを評価 | 表示モード |
|
|
|
|||||
|
やあ。
それはあなたの目的が何であるか明らかではありません。あなたの建設では、内側のループに入るたびに、シーケンスを再度開始する-は、ループの性質だ。 ここに、どうすればよいだろうが、それを達成しようとしていることを推測されます: コード:
#!/bin/bash -
# @(#) s2 Demonstrate array use for processing in parallel.
# See http://www.tldp.org/LDP/abs/html/arrays.html for details on
# arrays.
echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1)
set -o nounset
echo
echo " Results:"
no1=( 1 6 5 4 8 )
no2=( 4 7 8 0 1 )
length=${#no1[*]}
echo " length is $length"
i=0
while (( i < length ))
do
echo iteration $i no1[$i] = ${no1[$i]}, no2[$i] = ${no2[$i]}
(( i++ ))
done
exit 0
コード:
% ./s2 (Versions displayed with local utility "version") Linux 2.6.11-x1 GNU bash 2.05b.0 Results: length is 5 iteration 0 no1[0] = 1, no2[0] = 4 iteration 1 no1[1] = 6, no2[1] = 7 iteration 2 no1[2] = 5, no2[2] = 8 iteration 3 no1[3] = 4, no2[3] = 0 iteration 4 no1[4] = 8, no2[4] = 1 |
![]() |
| ブックマーク |
| タグ |
| インクリメントループのネスト |
| スレッドツール | このスレッドを検索 |
| 表示モード | このスレッド |
|
|