From 117265c6df389e85383093beac4dac780f9b6fd8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 4 Jun 2015 08:59:16 +1200 Subject: Use TIMEFORMAT rather than munge the output --- nscaw | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nscaw b/nscaw index c3decf1..befb6c7 100755 --- a/nscaw +++ b/nscaw @@ -55,14 +55,10 @@ username=$(whoami) # Attempt to run command within a time wrapper # exec 3>&1 4>&2 -time=$( { time "$@" 1>&3 2>&4 ; } 2>&1) ; ret=$? +TIMEFORMAT=$'real %3lR, user %3lU, sys %3lS\n' \ + time=$( { time "$@" 1>&3 2>&4 ; } 2>&1) ; ret=$? exec 3>&- 4>&- -# Munge the time to make it palatable as a single line -time=${time#$'\n'} # Strip leading newline -time=${time//$'\n'/, } # Change all newlines to comma-space -time=${time//$'\t'/ } # Change all tabs to spaces - # Decide return code and message based on command exit value case $ret in 0) -- cgit v1.2.3