-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.sh
executable file
·88 lines (87 loc) · 1.59 KB
/
game.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
trap ctrl_c INT
trap handle_exit exit
function ctrl_c() {
exit 0
}
function handle_exit() {
clear
echo "CLEANED UP"
cd $GAME_DIR
./cleanup.sh
}
./worldbuild.sh
GAME_DIR=`pwd -P`
echo "ls
ls -l
cd
less" > $GAME_DIR/tool.kit
cd game
localHome=`pwd -P`
absoluteHome=`pwd -P`
homeLen=${#localHome}
currDir=$localHome
cmd=">>"
cd start
clear
less README.txt
while :
do
currDir=`pwd -P`
read -p "`pwd -P`$cmd " inputline
currCommand=$(grep "$inputline" $GAME_DIR/tool.kit)
echo "$inputline" > $GAME_DIR/.hist
if [[ $inputline == "exit" ]]
then
exit 0
elif [[ ${inputline:0:4} == "less" ]]
then
$inputline 2>&1
elif [[ ${inputline:0:2} == "cd" ]]
then
$inputline 2>&1
currDir=`pwd -P`
if [[ $currDir == $localHome/D1 ]]
then
homeLen=${#currDir}
localHome=$currDir
cmd=">LOCK>"
fi
if [[ $currDir == $localHome/D2 ]]
then
xrandr --output LVDS1 --rotate inverted
fi
elif [[ $currCommand != "" ]]
then
$inputline 2>&1
else
if [[ $currDir == $absoluteHome/D1 ]]
then
if [[ $inputline == "./escape.sh" ]]
then
echo "USAGE: ./escape.sh <password>"
elif [[ $inputline == "./escape.sh EXECUTION" ]]
then
cd ..
currDir=`pwd -P`
localHome=`pwd -P`
homeLen=${#currDir}
cmd=">>"
mv D1/ D1\<COMPLETE\>
cd ..
./buildD2.sh
cd game
else
echo "$inputline: command?? not found in toolkit"
fi
else
echo "$inputline: command not found in toolkit"
fi
fi
currDir=`pwd -P`
if [[ ${#currDir} < $homeLen ]]
then
echo "ACCESS DENIED"
cd $localHome
fi
done