適当に、whileやforでループで回したいことがよくある。
が、Ctrl+cで抜けられないこともよくある。だけど、できるだけ面倒なことはしたくない。
なのでSIGINT(Ctrl+Cのシグナル)でトラップ受けたらexitするようにしておく。
#!/bin/bash
trap loopend SIGINT
loopend() {
echo ""
echo "Finished Loop"
exit
}
while :; do
dnsperf -s 192.168.0.1 -d ../sample-query-data/queryfile-example-10million-201202_part01 -S 1 -q 20 -c 1 -b 2048000
done