comparison help/help_diff.sh @ 10636:7938ee85f355

shorter, sweeter, more portable, better calling syntax
author diego
date Sun, 17 Aug 2003 01:20:48 +0000
parents 450015fb59e6
children 96170748b6a9
comparison
equal deleted inserted replaced
10635:9f589589f9be 10636:7938ee85f355
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # This script walks through the master (stdin) help/message file, and 3 # This script compares a translated help file to the master file and prints
4 # prints (stdout) only those messages which are missing from the help 4 # out any missing messages. Needs the language code as parameter ($1).
5 # file given as parameter ($1).
6 # 5 #
7 # Example: help_diff.sh help_mp-hu.h < help_mp-en.h > missing.h 6 # Example: help_diff.sh hu
8 7
9 curr="" 8 exec < help_mp-en.h
10 9
11 while read -r line; do 10 while read line; do
12 if echo "$line" | grep -q '^#define'; then 11 if echo "$line" | grep '^#define' > /dev/null 2>&1; then
13 curr=`echo "$line" | cut -d ' ' -f 2` 12 curr=`echo "$line" | cut -d ' ' -f 2`
14 if grep -q "^#define $curr " $1; then 13 if grep "^#define $curr" help_mp-$1.h > /dev/null 2>&1; then
15 curr="" 14 true
16 fi 15 else
17 else 16 echo "$line"
18 if [ -z "$line" ]; then
19 curr=""
20 fi 17 fi
21 fi 18 fi
22
23 if [ -n "$curr" ]; then
24 echo "$line"
25 fi
26 done 19 done
27
28