-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper
More file actions
executable file
·67 lines (54 loc) · 1.42 KB
/
helper
File metadata and controls
executable file
·67 lines (54 loc) · 1.42 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# RUN THIS SCRIPT WITH SUDO
shopt -s nullglob
while getopts p: flag
do
case $flag in
p) fPath=${OPTARG};;
esac
done
cd $fPath
for file in *; do
if [[ $file == *" "* ]]; then
mv "$file" "${file// /_}"
fi
done
for rarFile in *.{rar,zip}
do
dirName=$(echo $rarFile | awk -F'.' '{print $1}')
mkdir $dirName
if [ $(echo $rarFile | awk -F'.' '{print $2}') == "rar" ]; then
unrar e $rarFile $dirName -inul
else
unzip -j -qq $rarFile -d $dirName
fi
cd $dirName
for srcFile in *; do
if [[ $srcFile == *" "* ]]; then
mv "$srcFile" "${srcFile// /_}"
fi
done
for cFile in *.{c,cpp}
do
if [ $(echo $cFile | awk -F'.' '{print $2}') == "c" ]; then
gcc $cFile -o "$(echo $cFile | awk -F'.' '{print $1}').o"
else
g++ $cFile -o "$(echo $cFile | awk -F'.' '{print $1}').o"
fi
done
cFiles=( *.{c,cpp} )
oFiles=( *.o )
ls *.{c,cpp}
echo $rarFile
echo "Specify the file to review and run (like 1 for file1, 2 for file2...)"
read fileNum && fileNum=$((fileNum-1))
xfce4-terminal --geometry 150x40+400+70 --hold -e "nano ./${cFiles[$fileNum]}" &
codeReviewId="$!"
xfce4-terminal --geometry 150x40+400+70 --hold -e "./${oFiles[$fileNum]}" &
programReviewId="$!"
wait "$programReviewId"
wait "$codeReviewId"
cd ..
rm -rf $dirName
rm -rf $rarFile
done