changeset 1356:5198cfb8e368

Cosmetic tweak to miniconfig script.
author Rob Landley <rob@landley.net>
date Sat, 21 May 2011 23:38:59 -0500
parents 71acb8c4611a
children a1dc80180a05
files sources/toys/miniconfig.sh
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sources/toys/miniconfig.sh	Sat May 21 23:37:31 2011 -0500
+++ b/sources/toys/miniconfig.sh	Sat May 21 23:38:59 2011 -0500
@@ -76,10 +76,7 @@
 I=1
 while true
 do
-  if [ $I -gt $LENGTH ]
-  then
-    break
-  fi
+  [ $I -gt $LENGTH ] && break
   sed -n "$I,$(($I+${STRIDE:-1}-1))!p" mini.config > .config.test
   # Do a config with this file
   rm .config
@@ -90,6 +87,9 @@
     # Found unneeded line(s)
     mv .config.test mini.config
     LENGTH=$(($LENGTH-${STRIDE:-1}))
+    # Cosmetic: if stride tests off the end don't show total length less
+    # than number of entries found.
+    [ $I -gt $LENGTH ] && LENGTH=$(($I-1))
     # Special case where we know the next line _is_ needed: stride 2 failed
     # but we discarded the first line
     [ -z "$STRIDE" ] && [ ${OLDSTRIDE:-1} -eq 2 ] && I=$(($I+1))