Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Apr 2015 01:30:09 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org
Subject:   svn commit: r46422 - head/share/examples
Message-ID:  <201504020130.t321U9m1031759@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu Apr  2 01:30:08 2015
New Revision: 46422
URL: https://svnweb.freebsd.org/changeset/doc/46422

Log:
  doc/share/examples: slight modernization
  
  - stop using the 'X' trick
  - use more quotes

Modified:
  head/share/examples/add-manref.sh
  head/share/examples/check-manref.sh

Modified: head/share/examples/add-manref.sh
==============================================================================
--- head/share/examples/add-manref.sh	Wed Apr  1 22:23:09 2015	(r46421)
+++ head/share/examples/add-manref.sh	Thu Apr  2 01:30:08 2015	(r46422)
@@ -28,7 +28,7 @@ word_on_line () {
 	sed -E 's/^[[:digit:]]*:<\\!ENTITY man[.]([-[:alnum:].]*)[.][[:digit:]]* \".*$$/\1/'`;
 }
 
-if [ X$3 = X ]; then
+if [ -z "$3" ]; then
     echo "usage: $0 file name section";
     exit 2;
 fi
@@ -40,14 +40,14 @@ k=`echo $n | sed 's/_/./g'`;
 
 firstline=`grep -n "^<\\!ENTITY man[.][-[:alnum:].]*[.]$s \"" $i | \
     head -1 | cut -d: -f1`;
-if [ "X$firstline" = "X" ]; then
+if [ -z "$firstline" ]; then
     echo "Can't find first line of section $s.";
     exit 2;
 fi
 echo "First line of section $s is $firstline.";
 lastline=`grep -n "^<\\!ENTITY man[.][-[:alnum:].]*[.]$s \"" $i | \
     tail -1 | cut -d: -f1`;
-if [ "X$lastline" = "X" ]; then
+if [ -z "$lastline" ]; then
     echo "Can't find last line of section $s.";
     exit 2;
 fi

Modified: head/share/examples/check-manref.sh
==============================================================================
--- head/share/examples/check-manref.sh	Wed Apr  1 22:23:09 2015	(r46421)
+++ head/share/examples/check-manref.sh	Thu Apr  2 01:30:08 2015	(r46422)
@@ -28,7 +28,7 @@ word_on_line () {
 	sed -E 's/^[[:digit:]]*:<\\!ENTITY man[.]([-[:alnum:].]*)[.][[:digit:]]* \".*$$/\1/'`;
 }
 
-if [ X$2 = X ]; then
+if [ -z "$2" ]; then
     echo "usage: $0 file section";
     exit 2;
 fi
@@ -38,21 +38,21 @@ s=$2;
 
 firstline=`grep -n "^<\\!ENTITY man[.][-[:alnum:].]*[.]$s \"" $i | \
     head -1 | cut -d: -f1`;
-if [ "X$firstline" = "X" ]; then
+if [ -z "$firstline" ]; then
     echo "Can't find first line of section $s.";
     exit 2;
 fi
 echo "First line of section $s is $firstline.";
 lastline=`grep -n "^<\\!ENTITY man[.][-[:alnum:].]*[.]$s \"" $i | \
     tail -1 | cut -d: -f1`;
-if [ "X$lastline" = "X" ]; then
+if [ -z "$lastline" ]; then
     echo "Can't find last line of section $s.";
     exit 2;
 fi
 echo "Last line of section $s is $lastline.";
 
-x=$firstline;
-while [ $x != $lastline ]; do
+x="$firstline";
+while [ "$x" != "$lastline" ]; do
     wol_l=$x;
     word_on_line;
     if [ "$last" ]; then



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504020130.t321U9m1031759>