-
-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathtry.sh
More file actions
executable file
·63 lines (54 loc) · 1.78 KB
/
Copy pathtry.sh
File metadata and controls
executable file
·63 lines (54 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
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC entry 1992/adrian
#
# 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
# don't redirect output to /dev/null so that they can see how it's done,
# assuming it's not already built
make CC="$CC" everything || exit 1
# DON'T clear the screen so they can see how the files are generated!
for f in adrian.grep.*; do
echo 1>&2
read -r -n 1 -p "Press any key to show: $f: "
echo 1>&2
cat "$f"
echo 1>&2
read -r -n 1 -p "Press any key to run: ./adrian $f < README.md: "
echo 1>&2
./adrian "$f" < README.md
echo 1>&2
done
read -r -n 1 -p "Press any key to run: ./adhead try.sh: "
echo 1>&2
./adhead try.sh
echo 1>&2
read -r -n 1 -p "Press any key to run: ./adecho 1992 IOCCC adrian: "
echo 1>&2
./adecho 1992 IOCCC adrian
echo 1>&2
rm -f wc.adwc.txt adwc.adwc.txt
echo "$ wc adwc.c | sed -e 's/^[[:space:]]//g' | tr -s '[:space:]' | \\" 1>&2
echo " cut -d' ' -f1-3 | tee wc.adwc.txt" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
wc adwc.c | sed -e 's/^[[:space:]]//g' | tr -s '[:space:]' | cut -d' ' -f1-3 | tee wc.adwc.txt
echo 1>&2
echo "$ ./adwc adwc.c|tr -s ' '|sed -e 's/^[[:space:]]//g' | tee adwc.adwc.txt" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./adwc adwc.c|tr -s ' '|sed -e 's/^[[:space:]]//g' | tee adwc.adwc.txt
echo 1>&2
read -r -n 1 -p "Press any key to show diff between wc.adwc.txt and adwc.adwc.txt: "
echo 1>&2
diff -s wc.adwc.txt adwc.adwc.txt
echo 1>&2
rm -f wc.adwc.txt adwc.adwc.txt
echo "$ ./adsleep 10" 1>&2
read -r -n 1 -p "Press any key to make your computer take a 10 second nap (./adsleep 10): "
echo 1>&2
./adsleep 10