-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·46 lines (39 loc) · 1.19 KB
/
run
File metadata and controls
executable file
·46 lines (39 loc) · 1.19 KB
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/bash
filename=`ls -t1 | grep "\.cc\|\.py\|\.js" | head -n 1`
base="${filename::-3}"
ext="${filename##*.}"
print() {
echo "-------------------------------"
echo "Settings"
echo "-------------------------------"
echo "Filename : ${filename}"
echo "Extension: ${ext}"
echo "Basename : ${base}"
echo "-------------------------------"
echo ""
}
print
if [ "${ext}" == "cc" ] ; then
# echo "C++ mode"
g++ $filename -g -std=c++17 -Wno-unused-parameter -Wall -Wextra -Wconversion -Wshadow -Wfatal-errors -o sol || exit
for i in *.in; do
echo --- $i
./sol < $i > o && (diff -Z -y o ${i::-3}.[ao]?? > t || cat t) || cat o
done
fi
if [ "${ext}" == "py" ] ; then
# echo "Python mode"
for i in *.in; do
echo --- $i
python ${filename} < $i > o && (diff -Z -y o ${i::-3}.[ao]?? > t || cat t) || cat o
# "/c/Python37/python.exe" ${filename} < $i > o && (diff -Z -y o ${i::-3}.[ao]?? > t || cat t) || cat o
done
fi
if [ "${ext}" == "js" ] ; then
# echo "JavaScript mode"
for i in *.in; do
echo --- $i
node ${filename} < $i > o && (diff -Z -y o ${i::-3}.[ao]?? > t || cat t) || cat o
done
fi
exit