Rename 2001/westley/westley.sh to try.sh

The rest of the entry has not been reviewed except that the 'to use'
section has been corrected (and the try section obviously has been
updated too). I have some improvements to try.sh in mind but that'll
have to happen another time.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-16 05:35:31 -08:00
1 parent 4dceab913a
commit e600715fe7
3 files changed
+28 -7

No files matched your search

+7 -2
View File
@@ -9,13 +9,18 @@ make
```sh
./westley
# enter some input, terminate with EOF
echo foo | ./westley
./westley < westley.c
```
### Try:
```sh
./westley.sh
./try.sh
```
@@ -43,7 +48,7 @@ Use `westley.sort` as you would `westley` above.
The author also stated that if you just sort the code you'll get the with
`sort`) version that just prints out the punch card. The
[westley.punch.c](westley.punch.c) code specifically so that Westley can punch
[westley.punch.c](westley.punch.c) code is specifically so that Westley can punch
everyone in the face! :-) This is also compiled by default.
To use, try:
@@ -1,14 +1,30 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2001/westley
#
echo "./westley < westley.c 2>/dev/null > westley2.c"
# 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
# clear screen after compilation so that only the entry is shown
clear
echo "./westley < westley.c 2>/dev/null > westley2.c" 1>&2
./westley < westley.c 2>/dev/null > westley2.c
make westley2 2>/dev/null 1>&2
echo "Compiling westley2.c..." 1>&2
make CC="$CC" westley2 2>/dev/null 1>&2
echo
echo "echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null"
echo "$ echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null"
echo 'Bozos, please deflate shoes before entering the bus!'| ./westley2 2>/dev/null
echo
make westley.sort 2>/dev/null 1>&2
make CC="$CC" westley.sort 2>/dev/null 1>&2
echo
echo "./westley.sort < westley.c 2>/dev/null | diff - westley.c"
# SC2094 (info): Make sure not to read and write the same file in the same pipeline.