From 1adcbf82eb2f9600a0b65433a91679a88d88aac5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:28:56 -0800 Subject: [PATCH] Improve scripts of 2013/dlowe The try.sh script cannot be modified to prompt the user to run commands as the other scripts (or at least one, diff.sh) make use of tail(1) on the output. The script diff.sh however can have that and it has been done. Minor fixes in display in slflen.sh. --- 2013/dlowe/diff.sh | 22 +++++++++++++++------- 2013/dlowe/slflen.sh | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/2013/dlowe/diff.sh b/2013/dlowe/diff.sh index bdeb9527a..6eb49cbcf 100755 --- a/2013/dlowe/diff.sh +++ b/2013/dlowe/diff.sh @@ -11,12 +11,20 @@ if [[ -z "$CC" ]]; then fi make CC="$CC" all >/dev/null || exit 1 -echo "$ ./try.sh | tail -n 3 > 1.txt" 1>&2 -./try.sh | tail -n 3 > 1.txt +read -r -n 1 -p "Press any key to run: ./try.sh | tail -n 3 | tee 1.txt: " +./try.sh | tail -n 3 | tee 1.txt + echo "$ echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt" 1>&2 -echo 'IOCCC winning entry 2013/dlowe' > ioccc.txt -echo "$ ./try.sh | tail -n 3 > 2.txt" 1>&2 -./try.sh | tail -n 3 > 2.txt -echo "$ diff 1.txt 2.txt" 1>&2 -diff 1.txt 2.txt +read -r -n 1 -p "Press any key to run: echo 'IOCCC winning entry 2013/dlowe' | tee ioccc.txt: " +echo 1>&2 +echo 'IOCCC winning entry 2013/dlowe' | tee ioccc.txt + +read -r -n 1 -p "Press any key to run: ./try.sh | tail -n 3 | tee 2.txt: " +echo 1>&2 +./try.sh | tail -n 3 | tee 2.txt +echo 1>&2 + +read -r -n 1 -p "Press any key to run: diff -s 1.txt 2.txt: " +echo 1>&2 +diff -s 1.txt 2.txt rm -f 1.txt 2.txt ioccc.txt diff --git a/2013/dlowe/slflen.sh b/2013/dlowe/slflen.sh index 399051543..7a492f246 100755 --- a/2013/dlowe/slflen.sh +++ b/2013/dlowe/slflen.sh @@ -15,5 +15,7 @@ make CC="$CC" all >/dev/null || exit 1 ln -sf dlowe sparkl ls -1 * +echo 1>&2 echo -n "sparkline length of above files: " wc -c ./* | awk '{print $1}' | xargs ./sparkl +echo 1>&2