-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcp_and_diff.bash
71 lines (60 loc) · 1.23 KB
/
cp_and_diff.bash
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
GRN="\033[0;32m"
YEL="\033[0;33m"
BLU="\033[0;34m"
RED="\033[0;35m"
NC="\033[0m"
if [[ $# < 2 ]] ; then
echo -e "${GRN}[2 args needed]\n"
echo "Supply directory with source [.s]"
echo -e " and directory to be created for testing "
echo -e "If a third argument is provided, will silent creation of .cor ${NC}"
exit 1
fi
args=("$@")
arg1=${args[0]}
arg2=${args[1]}
ZAZ="/nfs/2014/r/rbaum/corewar_ressources/asm"
ME=$PWD"/asm"
mkdir -p $2
#
# exit 1
for OUTPUT in $(ls $arg1)
do
SUB=$(echo $OUTPUT | cut -d '.' -f 1)
EXT=$(echo $OUTPUT | cut -d '.' -f 2)
if [ "$EXT" = "s" ];
then
SEC=$arg2"/"$OUTPUT
FIRST=$arg1"/"$OUTPUT
cp $FIRST $SEC
if [[ ${args[2]} ]];
then
$ZAZ $FIRST > /dev/null 2>&1
$ME $SEC > /dev/null 2>&1
else
echo -e "${YEL}" "\n"
$ZAZ $FIRST
echo -e "${GRN}" "\n"
$ME $SEC
fi
fi
done
for OUTPUT in $(ls $arg1)
do
SUB=$(echo $OUTPUT | cut -d '.' -f 1)
EXT=$(echo $OUTPUT | cut -d '.' -f 2)
if [ "$EXT" = "cor" ];
then
FILE_ONE=$arg1"/"$OUTPUT
FILE_TWO=$arg2"/"$OUTPUT
# echo -e "${RED} $FILE_ONE \n"
# echo -e "${BLU} $FILE_TWO \n"
echo -en "${RED}"
diff $FILE_ONE $FILE_TWO
# if [[ $? -eq 0 ]];
# then
# echo -e "No diff "
# fi
# echo $?
fi
done