forked from ioccc-src/winner
-
Notifications
You must be signed in to change notification settings - Fork 6
/
try.sh
executable file
·108 lines (86 loc) · 2.98 KB
/
try.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC entry 2011/akari
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
# in this case we won't fail if we can't compile the code because we can still
# run the supplementary program.
make CC="$CC" all >/dev/null
# clean out old binaries except the entry itself
rm -f akari2 akari3 akari4
# clear screen after compilation so that only the entry is shown
clear
echo "Before you begin you might wish to open example.ppm in a graphics viewer." 1>&2
read -r -n 1 -p "Press any key to run: ./akari < example.ppm > odd_output.ppm: "
echo 1>&2
./akari < example.ppm > odd_output.ppm
echo 1>&2
echo "You might care to open odd_output.ppm in a graphics viewer." 1>&2
read -r -n 1 -p "Press any key to run: ./akari - - even < example.ppm > even_output.ppm: "
echo 1>&2
./akari - - even < example.ppm > even_output.ppm
echo 1>&2
echo "You might care to open even_output.ppm in a graphics viewer." 1>&2
read -r -n 1 -p "Press any key to run: ./akari example.ppm odd_output.ppm: "
echo 1>&2
./akari example.ppm odd_output.ppm
echo 1>&2
read -r -n 1 -p "Press any key to run: make akari2 >/dev/null || exit 1: "
echo 1>&2
make akari2 >/dev/null || exit 1
echo 1>&2
read -r -n 1 -p "Press any key to show akari2.c (space = next page, q = quit): "
echo 1>&2
less -rEXF akari2.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari2 < akari2.c (space = next page, q = quit): "
echo 1>&2
./akari2 < akari2.c | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari2 rot13 < akari2.c (space = next page, q = quit): "
echo 1>&2
./akari2 rot13 < akari2.c | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to run: make akari3 >/dev/null|| exit 1: "
echo 1>&2
make akari3 >/dev/null|| exit 1
echo 1>&2
read -r -n 1 -p "Press any key to show akari3.c: "
echo 1>&2
cat akari3.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari3: "
echo 1>&2
./akari3
echo 1>&2
read -r -n 1 -p "Press any key to run: make akari4 >/dev/null|| exit 1: "
echo 1>&2
make akari4 >/dev/null|| exit 1
echo 1>&2
read -r -n 1 -p "Press any key to show akari4.c: "
echo 1>&2
cat akari4.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./akari4: "
echo 1>&2
./akari4
echo 1>&2
echo "$ ./akari2 rot13 < akari.c | ./akari | tee rot13.c" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./akari2 rot13 < akari.c | ./akari | tee rot13.c | less -rEXF
echo "$ ./akari2 < akari.c | tee expanded_output.txt" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./akari2 < akari.c | tee expanded_output.txt | less -rEXF
echo 1>&2
echo "$ ./akari2 rot13 < akari.c | tee expanded_and_rot13_output.txt" 1>&2
read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./akari2 rot13 < akari.c | tee expanded_and_rot13_output.txt | less -rEXF
echo 1>&2