1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# gendef filename var=val var=val file=$1 shift defs="#define $1" shift for def do defs="$defs #define $def" done t=/tmp/groff.$$ sed -e 's/=/ /' >$t <<EOF $defs EOF test -r $file && cmp -s $t $file || cp $t $file rm -f $t exit 0