-
-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathtry.alt.sh
More file actions
executable file
·63 lines (51 loc) · 1.55 KB
/
Copy pathtry.alt.sh
File metadata and controls
executable file
·63 lines (51 loc) · 1.55 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
#!/usr/bin/env bash
#
# try.alt.sh - demonstrate IOCCC entry 2000/tomx alternate code
#
# 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" alt >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
read -r -n 1 -p "Press any key to run: rm -v -f mkentry: "
echo 1>&2
rm -v -f mkentry
echo 1>&2
read -r -n 1 -p "Press any key to run: chmod +x tomx.alt.c: "
echo 1>&2
chmod +x tomx.alt.c
echo 1>&2
echo "Using tomx.alt.c as an executable to compile mkentry.c directly:" 1>&2
read -r -n 1 -p "Press any key to run: ./tomx.alt.c: "
echo 1>&2
./tomx.alt.c
echo 1>&2
read -r -n 1 -p "Press any key to run: ./mkentry -h | tee mkentry.help.txt: "
echo 1>&2
./mkentry | tee mkentry.help.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: rm -v -f mkentry: "
echo 1>&2
rm -v -f mkentry
echo 1>&2
echo "Using tomx.alt.c as a Makefile to compile mkentry.c:" 1>&2
read -r -n 1 -p "Press any key to run: make -f tomx.alt.c: "
echo 1>&2
make -f tomx.alt.c
echo 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./tomx.alt (mkentry compiled from tomx.alt.c): "
echo 1>&2
./tomx.alt | tee tomx.help.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: diff -s mkentry.help.txt tomx.help.txt: "
echo 1>&2
diff -s mkentry.help.txt tomx.help.txt
echo 1>&2
read -r -n 1 -p "Press any key to remove mkentry.help.txt and tomx.help.txt: "
echo 1>&2
rm -v -f mkentry.help.txt tomx.help.txt