svn commit: r46422 - head/share/examples

Eitan Adler <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.