doc/share/examples: slight modernization

- stop using the 'X' trick
- use more quotes
This commit is contained in:
Eitan Adler 2015-04-02 01:30:08 +00:00
parent b97554245f
commit 4f86d190ba
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=46422
2 changed files with 8 additions and 8 deletions

View file

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

View file

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