From 996f716fe1eb6254155e240af5f868bd23d47d43 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:06:05 -0800 Subject: [PATCH] Improve 2012/endoh1/try.sh --- 2012/endoh2/try.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/2012/endoh2/try.sh b/2012/endoh2/try.sh index 5c0acae4a..0d8a57cba 100755 --- a/2012/endoh2/try.sh +++ b/2012/endoh2/try.sh @@ -17,11 +17,17 @@ clear run() { - local program="$1" - echo "" 1>&2 - read -r -n 1 -p "Press any key to run: ./${program} (space = next page, q = quit): " - "./${program}" | less -K -E -X + if [[ "$#" -eq 0 ]]; then + echo "$0: run() expects at least 1 arg, got: $#" 1>&2 + return + fi + + echo 1>&2 + read -r -n 1 -p "Press any key to run: ./$1 (space = next page, q = quit): " + echo 1>&2 + ./"$1" | less -rKEXF } + run pi run 314 run 3141