-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmpAll.sh
57 lines (49 loc) · 1.08 KB
/
cmpAll.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
#!/bin/bash
echo -e "C"
gcc $1.c || exit 1
cstdout=`./a.out < $2` || exit 1
rm a.out
if [ "1" = "$CXX" ]; then
echo -e "C++"
g++ $1.cc || exit 1
ccstdout=`./a.out < $2` || exit 1
rm a.out
if [ "$cstdout" != "$ccstdout" ]; then
echo "<C>$cstdout</C><CC>$ccstdout</CC>"
exit 1;
fi
fi
if [ "1" = "$JAVA" ]; then
echo -e "java"
javac $1.java || exit 1
javastdout=`java $1 < $2` || exit 1
rm "$1.class"
if [ "$cstdout" != "$javastdout" ]; then
echo "<C>$cstdout</C><java>$javastdout</java>"
exit 1;
fi
fi
if [ "1" = "$PHP" ]; then
echo -e "php"
phpstdout=`php $1.php < $2` || exit 1
if [ "$cstdout" != "$phpstdout" ]; then
echo "<C>$cstdout</C><php>$phpstdout</php>"
exit 1;
fi
fi
if [ "1" = "$OCAML" ]; then
echo -e "ocaml"
mlstdout=`ocaml $1.ml < $2` || exit 1
if [ "$cstdout" != "$mlstdout" ]; then
echo "<C>$cstdout</C><ml>$mlstdout</ml>"
exit 1;
fi
fi
if [ "1" = "$TEX" ]; then
echo -e "\nlatex"
pdflatex "$1.tex" || exit 1
rm "$1.pdf"
fi
#echo -e "\nC#"
#gmcs $1.cs
#cat $2 | mono $1.exe || exit 1