1

tethereal -w /path/to/file1.pcap を実行する bash スクリプトのアイデアを探しています tethereal -w /path/to/file1.pcap 限られた時間または指定された時間だけ、cmdを終了して再起動する前に、わずかに異なる出力ファイル名を使用するため、2番目のファイルはwrites は file2.pcap のようなものです

ある種のループの線に沿って考えていましたが、スクリプトの経験が限られているため、これを行う最善の方法がわかりません。

すべての助けがありがたく受け取った

ファーマーグ

4

2 に答える 2

0
timeout=10 
for i in `seq 1 N` # notice that N we'll be your upper bound
do
  tethereal -w /path/to/file${i}.pcap &
  sleep $timeout;
  PID=`ps aux | grep tethereal | awk '{print $1}'`;
  kill -9 $PID;
done
于 2012-11-27T11:11:22.517 に答える
0
timeout_const=10
for i in {1..5}
do
    timeout $timeout_const tethereal -w /path/to/file${i}.pcap
done
于 2012-11-27T10:58:36.390 に答える