Chapter 30. check_localhost_line.sh
#!/bin/sh
# use xargs to convert N number of tabs to a single space
# (some files have one tab, some two)... makes RegCmp
# easier in cfengine if we collapse that to one space. aleksey.
IDEAL_LOCALHOST_STRING="$*"
ACTUAL_LOCALHOST_STRING=`grep localhost /etc/hosts | grep -v localhost6 | xargs echo`
if [ "$ACTUAL_LOCALHOST_STRING" != "$IDEAL_LOCALHOST_STRING" ]
then
echo String mis-match in /etc/hosts. Expected \"${IDEAL_LOCALHOST_STRING}\", got \"${ACTUAL_LOCALHOST_STRING}\".
fi