1 <span class="co0">#!/bin/bash</span>
2 <span class="re2">dir_names</span>=<span class="br0">(</span><span class="st0">"tcp/null"</span> <span class="st0">"tcp/sort"</span> <span class="st0">"udp/null"</span> <span class="st0">"udp/sort"</span> <span class="st0">"rpc/null/tcp"</span> <span class="st0">"rpc/null/udp"</span> <span class="st0">"rpc/sort/tcp"</span><span class="br0">)</span>
3 <span class="kw1">for</span> d <span class="kw1">in</span> <span class="br0">{</span>0..9<span class="br0">}</span>
4 <span class="kw1">do</span>
5 <span class="re2">dir_name</span>=<span class="co1">${dir_names[$d]}</span>
6 <span class="kw3">echo</span> <span class="st0">"<span class="es2">$dir_name</span>"</span>
7 <span class="kw2">mv</span> <span class="st0">"<span class="es2">$dir_name</span>/out.txt"</span> <span class="st0">"<span class="es2">$dir_name</span>/out.bak.txt"</span>
8 <span class="kw1">for</span> j <span class="kw1">in</span> <span class="br0">{</span>0..3<span class="br0">}</span>
9 <span class="kw1">do</span>
10 <span class="co0">#echo "$j"</span>
11 <span class="kw1">for</span> i <span class="kw1">in</span> <span class="br0">{</span>0..9<span class="br0">}</span>
12 <span class="kw1">do</span>
13 <span class="co0">#echo "$i"</span>
14 <span class="kw1">if</span> <span class="br0">[</span> <span class="st0">"<span class="es2">$d</span>"</span> = <span class="st0">"8"</span> <span class="br0">]</span> <span class="sy0">||</span> <span class="br0">[</span> <span class="st0">"<span class="es2">$d</span>"</span> = <span class="st0">"9"</span> <span class="br0">]</span>
15 <span class="kw1">then</span>
16 <span class="kw3">cd</span> <span class="st0">"<span class="es2">$dir_name</span>"</span>
17 <span class="co0">#java Client 127.0.0.1:808"$d" >> "out.txt"</span>
18 java Client 143.54.12.150:<span class="nu0">808</span><span class="st0">"<span class="es2">$d</span>"</span> <span class="sy0">>></span> <span class="st0">"out.txt"</span>
19 <span class="kw3">cd</span> <span class="st0">"../../"</span>
20 <span class="kw1">else</span>
21 <span class="co0">#./"$dir_name/client" 127.0.0.1 808"$d" >> "$dir_name/out.txt"</span>
22 .<span class="sy0">/</span><span class="st0">"<span class="es2">$dir_name</span>/client"</span> 143.54.12.150 <span class="nu0">808</span><span class="st0">"<span class="es2">$d</span>"</span> <span class="sy0">>></span> <span class="st0">"<span class="es2">$dir_name</span>/out.txt"</span>
23 <span class="kw1">fi</span>
24 <span class="kw1">done</span>
25 <span class="kw2">sleep</span> 60
26 <span class="kw1">done</span>
27 .<span class="sy0">/</span>calc.rb <span class="st0">"<span class="es2">$dir_name</span>/out.txt"</span>
28 <span class="kw1">done</span>