-
Notifications
You must be signed in to change notification settings - Fork 109
/
mcedit.command
executable file
·48 lines (40 loc) · 938 Bytes
/
mcedit.command
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
#!/bin/bash
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "R" ]; then
default=Y
elif [ "${2:-}" = "enter" ]; then
default=Y
elif [ "${2:-}" = "Y" ]; then
default=Y
else
default=N
fi
# Ask the question
read -p "$1 " REPLY
# Default?
if [ -z "$REPLY" ]; then
REPLY=$default
fi
# Check if the reply is valid
case "$REPLY" in
R*|r*) return 0 ;;
*) return 1 ;;
esac
done
}
cd "$(dirname "$0")"
if ! type "python2" > /dev/null; then
# Just let all command line parameter be sent to the program.
python -B mcedit.py
else
python2 -B mcedit.py
fi
echo "-------------------------"
if ask "Press R to restart MCEdit, any other key to exit:"; then
clear
bash mcedit.command
else
echo "Quitting"
fi