how to use bash lists to time a group of commands

How do you run multiple commands in bash and calculate the total time taken to run all the commands? Use a list by surrounding the commands with curly braces:

time { sleep 2; uptime; true && date; }

The tricky bit is remembering to add that last semi-colon - without it, the command will fail to be parsed by bash. Also, the spaces either side of the curly braces are mandatory.

Comments

Popular posts from this blog

Byobu Bling with Unicode Custom Indicators

Procenv 0.46 - now with more platform goodness

Upstart User Sessions in Ubuntu Raring