view help/help_diff.sh @ 26870:8f3a1caf0e9a

Use 'grep -q' instead of redirecting grep output to /dev/null. The -q option is part of POSIX.
author diego
date Tue, 27 May 2008 14:33:16 +0000
parents 3ff3bd9bf0f9
children
line wrap: on
line source

#!/bin/sh

# This script walks through the master (stdin) help/message file, and
# prints (stdout) only those messages which are missing from the help
# file given as parameter ($1).
#
# Example: help_diff.sh help_mp-hu.h < help_mp-en.h > missing.h

# Processing the master file, nothing to do.
test $1 = "help/help_mp-en.h" && exit 0

curr=""

while read -r line; do
	if echo "$line" | grep -q '^#define' ; then
		curr=`printf "%s\n" "$line" | cut -d ' ' -f 2`
		if grep -q "^#define $curr[	 ]" $1 ; then
			curr=""
		fi
	else
		if [ -z "$line" ]; then
			curr=""
		fi
	fi

	if [ -n "$curr" ]; then
		printf "%s\n" "$line"
	fi
done