[PATCH 2/6] check: simplify check.time parsing

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



There's no need to use grep and awk when the latter can do all that's
needed, including the pretty printing.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>
---
 check | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/check b/check
index 42925e09..43c072d2 100755
--- a/check
+++ b/check
@@ -819,13 +819,9 @@ function run_section()
 		try="$try $seqnum"
 		n_try=`expr $n_try + 1`
 
-		# slashes now in names, sed barfs on them so use grep
-		lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
-		if [ "X$lasttime" != X ]; then
-			echo -n " ${lasttime}s ... "
-		else
-			echo -n "	" # prettier output with timestamps.
-		fi
+		awk 'BEGIN {lasttime="       "} \
+		     $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \
+		     END {printf "%s", lasttime}' "$check.time"
 		rm -f core $seqres.notrun
 
 		start=`_wallclock`
-- 
2.35.3




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux