-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·59 lines (46 loc) · 2.25 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·59 lines (46 loc) · 2.25 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
#!/bin/bash
#@Author Hafner Peter
#Date: 2023-11-10
bin=target/classes
testDir="test"
app="dev.hafnerp.Main"
########################################################################################################################
# Run the program...
########################################################################################################################
if [ ! -d "./target" ]; then
./build.sh
fi
if [ $1 == "--test" ]; then
java -classpath "$bin" "$app" --first &> /dev/null
if [ $? == 0 ]; then echo -e "\e[1;32m ###################### \e[0m - \"--first\" - Test successful!"
elif [ $? == 1 ]; then echo -e "\e[1;31m ###################### \e[0m - \--first\" - Test failed!"
fi
java -classpath "$bin" "$app" --first --word "if" &> /dev/null
if [ $? == 0 ]; then echo -e "\e[1;32m ###################### \e[0m - \"--first --word if\" - Test successful!"
elif [ $? == 1 ]; then echo -e "\e[1;31m ###################### \e[0m - \"--first --word if\" - Test failed!"
fi
java -classpath "$bin" "$app" --first --word &> /dev/null
if [ $? == 255 ]; then echo -e "\e[1;32m ###################### \e[0m - \"--first --word\" - Test successful!"
elif [ $? == 1 ]; then echo -e "\e[1;31m ###################### \e[0m - \"--first --word\" - Test failed!"
fi
java -classpath "$bin" "$app" --first --directory &> /dev/null
if [ $? == 255 ]; then echo -e "\e[1;32m ###################### \e[0m - \"-first --directory\" - Test successful!"
elif [ $? == 1 ]; then echo -e "\e[1;31m ###################### \e[0m - \"-first --directory\" - Test failed!"
fi
java -classpath "$bin" "$app" --first --directory ./ &> /dev/null
if [ $? == 0 ]; then echo -e "\e[1;32m ###################### \e[0m - \"--first --directory ./\" - Test successful!"
elif [ $? == 1 ]; then echo -e "\e[1;31m ###################### \e[0m - \"--first --directory ./\" - Test failed!"
fi
elif [ -z $1 ]; then
java -classpath $bin $app --word "if" --first
if [ $? == 0 ]; then
echo -e "\e[1;32m ***OK*** \e[0m app executed successfully!"
else
echo -e "\e[1;31m ***ERR*** \e[0m app executed NOT successfully!"
fi
else
echo "*********************************"
echo "Help Command --help | -h"
echo "Test Command --test"
echo "*********************************"
fi