[Pluto-help] Verifica di uno shell script

Giuseppe Tringali gtringali a katamail.com
Mer 22 Ago 2001 11:22:37 CEST


Ciao a tutti.

Sto utilizzando Linux da poco.

Tempo fa avevo inviato una mail in cui chiedevo se qualcuno poteva scrivere
uno shell script basandosi sullo script TCL allegato.
Poi ho provato a scrivere questo shell script da solo.
Se potete, date un'occhiata all'intero script, lo trovate in fondo alla
mail, e ditemi le modifiche da apportare perche'  credo che sia scritto
"maluccio".
Credo che lo script "faccia quello che devo fare", pero' mi servirebbe un
aiuto.

Con le seguenti righe (sono un estratto dello script)

awk -f th_p2.awk  out_tcp_$i.0.tr > th_tcp_$i.tr
echo "$i.0" >> th_tcp.tr
cat th_tcp.tr th_tcp_$i.tr> th_tcp.temp
cat th_tcp.temp > th_tcp.tr

ottengo il seguente file th_tcp.tr

0.0
0.757043
20.0
0.008243
40.0
0.002003
60.0
0.000283
80.0
0.000000
100.0
0.000000

Mentre vorrei ottenere un file con questa formattazione:

0.0 0.757043
20.0 0.008243
40.0 0.002003
60.0 0.000283
80.0 0.000000
100.0 0.000000

Potreste dirmi le opportune modifiche da fare allo script?

Vi ringrazio per la vostra attenzione e per il tempo che mi dedicherete,
Giuseppe Tringali

#! /bin/bash

if [ $# = 0 ]
then
     echo "ERROR! shell script called with wrong number of arguments!($#)"
else

step=$1
i=$[0]
max=$[100]
sim_counter=$[1]
nsim=$[$max/$step +1]

while (( $i <= $max ))
do

echo "Running simulation $sim_counter of $nsim with error rate $i% "
ns sat_tcp5.tcl $i.0
echo "Finished simulation $sim_counter of $nsim with error rate $i% "
echo "Post-processing the trace file "
awk -f th_p2.awk  out_tcp_$i.0.tr > th_tcp_$i.tr
echo "$i.0" >> th_tcp.tr
cat th_tcp.tr th_tcp_$i.tr> th_tcp.temp
cat th_tcp.temp > th_tcp.tr

echo "Finished post-processing"

#echo "Graphing results"
#xgraph cwnd_$i.0.tr sstresh_$i.0.tr -geometry 800x400 &
#xgraph cwnd_$i.0.tr -geometry 800x400 &
#echo "Finished graphing"

i=$[$i + $step]
sim_counter=$[$sim_counter + 1]

done

fi





More information about the pluto-help mailing list