Is there a way to have a bash script to print how long it took to run?
Something fairly simple like:
#!/bin/bash
something to start time
command to be run
something to calculate runtime and print result
There is the standard tool time.
The script:
#!/bin/bash
echo start
sleep 2
echo end
Usage:
$ time ./so.sh
start
end
./so.sh 0.00s user 0.01s system 0% cpu 2.007 total
You can use the time command:
time - run programs and summarize system resource usage
For example:
time <command>
Will give you the execution time of your commands
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With