Add 2020/otterness/try.sh

The .gitignore was updated but it cannot be sorted because it excludes
'*.mid' but then negates the .mid files in the repo, cvikl.mid and
entertainer.mid. These have to come after the exclusion of '*.mid'. This
is important as one might use the entry to create a .mid file that is
not done in the try script. The make clobber rule does not remove
'*.mid' files as doing so would remove the ones we want to keep.
This commit is contained in:
Cody Boone Ferguson committed 2024-02-01 07:45:59 -08:00
1 parent 06f291dc19
commit 5574f865cf
4 files changed
+37 -6

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2020/otterness
#
# 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.
[[ -z "$CC" || ! -f "$CC" || ! -x "$CC" ]] && CC="cc"
make CC="$CC" all >/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: ./prog < cvikl.mid > output.mid: "
echo 1>&2
./prog < cvikl.mid > output.mid
echo "Now play output.wav in an audio player that can play MIDI files." 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < entertainer.mid > output2.mid: "
echo 1>&2
./prog < entertainer.mid > output2.mid
echo "Now play output2.wav in an audio player that can play MIDI files." 1>&2
echo 1>&2