From: Shida Zhang <zhangshida@xxxxxxxxxx> #!/bin/bash cleanup() { echo "Ctrl+C detected. Killing child processes..." >&2 pkill -P $$ # Kill all child processes exit 1 } trap cleanup SIGINT SIGTERM ./frag.sh test.img mnt/ $((500*1024)) frag $1 ./frag.sh test.img mnt/ $((200*1024)) frag2 $1 ./frag.sh test.img mnt/ $((100*1024)) frag3 $1 ./frag.sh test.img mnt/ $((100*1024)) frag4 $1 ./frag.sh test.img mnt/ $((100*1024)) frag5 $1 ./frag.sh test.img mnt/ $((100*1024)) frag6 $1 ./frag.sh test.img mnt/ $((100*1024)) frag7 $1 ./frag.sh test.img mnt/ $((100*1024)) frag8 $1 ./frag.sh test.img mnt/ $((100*1024)) frag9 $1