Short question:
This is done on a Mac:
time for i in {1..10}; do python3 foo.py ; done but CTRL-C won't be able to stop it. How to make it work? (or how to time the running time of N times?)
Details:
There is some standard test of program from github, and I could run it:
python3 foo.py or
time python3 foo.py and it reports 0.27 seconds running time. Since the test is wired up for 1000 test cases and to a test framework, I don't want to change the test, so I want to time it 100 times. It seems the command time has no way to time it for 10 or 100 times (this is somewhat strange of Unix that so many years and something this useful and simple is not built into time). The following can be used:
time for i in {1..10}; do python3 foo.py ; done but CTRL-C won't be able to stop it -- it will stop that one python script and keep on running the rest. So fortunately it wasn't 100 or 1000 that was typed in. Is there a way to use time or a better way to do it? (besides changing the program?)
try.shwith#!/bin/sh time for i in {1..10}; do python3 foo.py ; doneand CTRL-C also doesn't work... doesn't a shell actually have something that is: when the shell script gets the CTRL-C, then stop it altogether?|| break.