There is a function that runs the command passed to it.
function run() { OLD_PWD=`pwd` cd `dirname "${BASH_SOURCE[0]}"`/.. if "$@" then echo "GOOD" cd ${OLD_PWD} else colorecho 1 "Command <$@> failed ... exiting" cd ${OLD_PWD} exit 1 fi } It is necessary to insert the time utility in the launch of this command, that is, I am writing run mkdir -p /some/thing/dir , and under the hood /usr/bin/time -f "%C %E" mkdir -p /some/thing/dir is called /usr/bin/time -f "%C %E" mkdir -p /some/thing/dir , tell me how to do it?