-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathtry.sh
More file actions
executable file
·66 lines (52 loc) · 1.78 KB
/
try.sh
File metadata and controls
executable file
·66 lines (52 loc) · 1.78 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
60
61
62
63
64
65
66
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC entry 1994/schnitzi
#
# 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
make CC="$CC" all >/dev/null || exit 1
read -r -n 1 -p "Press any key to run: ./schnitzi < schnitzi.c > schnitzi2.c: "
echo 1>&2
./schnitzi < schnitzi.c > schnitzi2.c 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: make schnitzi2: "
echo 1>&2
make schnitzi2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./schnitzi2 < schnitzi2.c > schnitzi3.c: "
echo 1>&2
./schnitzi2 < schnitzi2.c > schnitzi3.c 2>/dev/null
echo 1>&2
read -r -n 1 -p "Press any key to run: make schnitzi3: "
echo 1>&2
make schnitzi3
echo 1>&2
read -r -n 1 -p "Press any key to run: diff3 schnitzi.c schnitzi2.c schnitzi3.c (space = next page, q = quit): "
echo 1>&2
diff3 schnitzi.c schnitzi2.c schnitzi3.c | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to show try.txt: "
echo 1>&2
cat try.txt
echo 1>&2
rm -f try1.txt try2.txt try3.txt
read -r -n 1 -p "Press any key to run: ./schnitzi < try.txt | tee try1.txt (space = next page, q = quit): "
echo 1>&2
./schnitzi < try.txt 2>/dev/null | tee try1.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: ./schnitzi2 < try.txt | tee try2.txt (space = next page, q = quit): "
echo 1>&2
./schnitzi2 < try.txt 2>/dev/null | tee try2.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: ./schnitzi3 < try.txt | tee try3.txt (space = next page, q = quit): "
echo 1>&2
./schnitzi3 < try.txt 2>/dev/null | tee try3.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: diff3 try1.txt try2.txt try3.txt: "
echo 1>&2
diff3 try1.txt try2.txt try3.txt && echo "All three files are the same!"
echo 1>&2