Is is possible to print the execution time of a shell command with following combination?
root@hostname:~# "command to execute" && echo "execution time"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Don’t forget that there is a difference between bash’s builtin
time(which should be called by default when you dotime command) and/usr/bin/time(which should require you to call it by its full path).The builtin
timealways prints to stderr, but/usr/bin/timewill allow you to send time’s output to a specific file, so you do not interfere with the executed command’s stderr stream. Also,/usr/bin/time‘s format is configurable on the command line or by the environment variableTIME, whereas bash’s builtintimeformat is only configured by theTIMEFORMATenvironment variable.