-
Notifications
You must be signed in to change notification settings - Fork 14
/
verifyAllRec.sh
executable file
·82 lines (73 loc) · 1.73 KB
/
verifyAllRec.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
error=0
processeddirs=0
mydirs=()
mydirsstatus=()
# help and usage
help()
{
# Display Help
echo "Usage: $0 dir, where dirname is the folder you want to check."
echo "All .dfy files in the folder dirname will be checked."
echo
}
# Check number of arguments
if [ "$#" -ne 1 ];
then
echo "Illegal number of parameters"
help
exit 1
fi
if [ ! -d "$1" ]
then
echo -e "${RED}Error: Root directory $1 DOES NOT exists.${NC}"
exit 2
fi
echo "Processing " $1
LOG_FILE=$1/verif-`date +'%Y-%m-%d-%H:%M:%S'`.log
./verifyAll.sh $1 | tee $LOG_FILE
if [ $? -eq 0 ] # check if errors
then
echo -e "${GREEN}No errors in directory $dir${NC}"
else
echo -e "${RED}Some errors occured in directory $dir${NC}"
error=$((error + 1))
fi
# The list of dirs
listofdirs=`find $1 -maxdepth 1 -mindepth 1 -type d`
# listofdirs=`find $1 -maxdepth 1 -mindepth 1 -type d -printf '%p\n'`
for dir in $listofdirs
do
echo "Processing directories in " $dir
mydirs+=($dir)
./verifyAllRec.sh $dir
if [ $? -eq 0 ] # check if errors
then
echo -e "${GREEN}No errors in directory $dir${NC}"
mydirsstatus+=(1)
else
echo -e "${RED}Some errors occured in directory $dir${NC}"
error=$((error + 1))
mydirsstatus+=(0)
fi
done
if [ $error -ne 0 ]
then
echo -e "${RED}Some directories [$error/$processeddirs] has(ve) errors :-("
for i in ${!mydirs[@]}; do
if [ ${mydirsstatus[$i]} -ne 1 ]
then
echo -e "${RED}[FAIL] ${mydirs[$i]} has some errors :-(${NC}"
else
echo -e "${GREEN}[OK] ${mydirs[$i]}${NC}"
fi
done
exit 1
else
echo -e "${GREEN}No errors in any dirs! Great job.${NC}"
exit 0
fi