-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuva-reset
More file actions
executable file
·43 lines (31 loc) · 798 Bytes
/
uva-reset
File metadata and controls
executable file
·43 lines (31 loc) · 798 Bytes
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
#!/usr/bin/bash
#simple test for a uva problem manager
uvapath="/home/xrexeon/Desktop/uva"
if [ ! -d "$uvapath" ]; then
echo The uva directory \("$uvapath"\) does not exist
exit
fi
problem=$1
if [ ! -f "$problem" ]; then
echo The problem file \("$problem"\) does not exist
exit
fi
nameid=$2
if [ -f "$uvapath"/"$nameid".cpp ]; then
echo Duplicated problem found
exit
fi
cp -i "$problem" "$uvapath/$nameid.cpp" && \
echo Successfully saved "$problem" as "$nameid".cpp in "$uvapath"
read -n 1 -s -r -p "push to github?" yn
if [ "$yn" = "y" ]
then
cd "$uvapath" || exit
git add . && \
git commit -m "$nameid" && \
git push
echo Successfully git pushed
cd - || exit
fi
cp "$uvapath/problemTemplate.cpp" "$problem" && \
echo "$problem" was successfully reset from the template