File: Compare.sh

package info (click to toggle)
ftnchek 3.1.2-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,436 kB
  • ctags: 5,393
  • sloc: ansic: 24,609; fortran: 5,565; yacc: 3,682; sh: 2,518; makefile: 772; lisp: 264; f90: 94; perl: 76
file content (46 lines) | stat: -rwxr-xr-x 1,122 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# $Id: Compare.sh.in,v 1.2 2000/07/22 19:53:36 moniot Exp $
#
# Bourne shell script to compare File in directory ./Vary with
# original in directory ./Okay and print a message if they differ.
# If no differences it echoes a dot to show progress.
# If differences, touches file CHECK_FAILED
#
# Usage: Compare.sh Okay Vary File

OKAY=$1
VARY=$2
FILE=$3

	if [ ! -d ${OKAY} ]
	then
	    echo "Creating directory ${OKAY}"
	    mkdir ${OKAY};
	fi
	if [ ! -f ${OKAY}/${FILE} ]
	then
	    echo "${FILE} is new"
	    cp ${FILE} ${OKAY}/${FILE}
	fi
	if cmp ${OKAY}/${FILE} ${FILE} > /dev/null
	then
	    rm -f -f ${FILE}
	    echo '.' | gawk '{printf("%s",$1);}'
	else
	    touch CHECK_FAILED
	    echo ""
	    echo "--------------------------------------------------"
	    echo "====> Differences found in ${FILE} test <===="
	    echo "Master: ${OKAY}/${FILE}"
	    echo "Test:   ${VARY}/${FILE}"
	    if [ ! -d ${VARY} ]
	    then
		echo "Creating directory ${VARY}"
		mkdir ${VARY}
	    fi
	    mv ${FILE} ${VARY}/${FILE}
#  To show diffs uncomment next line
#	    diff ${OKAY}/${FILE} ${VARY}/${FILE}
	fi
	exit 0