From 51b9d3c096fd5dc9dcfbcd877552aa0991cd5db9 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 19 Jan 2024 07:09:15 -0800 Subject: [PATCH] Slightly modify 1998/dlowe/try scripts Allow specifying paths to man, col and cat. This is done in a way that the CC variable should have been done in all the other scripts (and this one) but I didn't think about it at the time. --- 1998/dlowe/README.md | 11 +++++++++-- 1998/dlowe/try.alt.sh | 12 ++++++------ 1998/dlowe/try.sh | 12 ++++++------ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/1998/dlowe/README.md b/1998/dlowe/README.md index 4532c8ead..a01c22f06 100644 --- a/1998/dlowe/README.md +++ b/1998/dlowe/README.md @@ -11,7 +11,9 @@ below for more details. ## To use: ```sh -./dlowe < anyfile > pootfile +./dlowe < file > pootfile + +./dlowe < file ``` @@ -42,6 +44,8 @@ Also try: ./try.sh ``` +Did you spot the Easter egg there? + ## Alternate code: @@ -59,7 +63,7 @@ make alt ### Alternate use: ``` -./dlowe.alt < anyfile > pootfile +./dlowe.alt < file > pootfile ``` What's the difference between this and `dlowe`? @@ -71,6 +75,9 @@ What's the difference between this and `dlowe`? ./try.alt.sh ``` +Did you spot the Easter egg there? + + ## Judges' remarks: diff --git a/1998/dlowe/try.alt.sh b/1998/dlowe/try.alt.sh index 05b11df0a..ca1a73410 100755 --- a/1998/dlowe/try.alt.sh +++ b/1998/dlowe/try.alt.sh @@ -5,18 +5,18 @@ make everything || exit 1 -CAT="$(type -P cat)" -MAN="$(type -P man)" -COL="$(type -P col)" +[[ -z "$CAT" ]] && CAT="$(type -P cat)" +[[ -z "$MAN" ]] && MAN="$(type -P man)" +[[ -z "$COL" ]] && COL="$(type -P col)" if [[ -z "$CAT" || ! -e "$CAT" ]]; then - echo "$0: no cat found" 1>&2 + echo "$0: no cat '$CAT' found" 1>&2 exit 1 elif [[ -z "$COL" || ! -e "$COL" ]]; then - echo "$0: col not found" 1>&2 + echo "$0: col '$COL' not found" 1>&2 exit 1 elif [[ -z "$MAN" || ! -e "$MAN" ]]; then - echo "$0: can't execute man" 1>&2 + echo "$0: can't execute '$MAN'" 1>&2 exit 1 fi diff --git a/1998/dlowe/try.sh b/1998/dlowe/try.sh index 18645fc87..419baa5c0 100755 --- a/1998/dlowe/try.sh +++ b/1998/dlowe/try.sh @@ -5,18 +5,18 @@ make all || exit 1 -CAT="$(type -P cat)" -MAN="$(type -P man)" -COL="$(type -P col)" +[[ -z "$CAT" ]] && CAT="$(type -P cat)" +[[ -z "$MAN" ]] && MAN="$(type -P man)" +[[ -z "$COL" ]] && COL="$(type -P col)" if [[ -z "$CAT" || ! -e "$CAT" ]]; then - echo "$0: no cat found" 1>&2 + echo "$0: no cat '$CAT' found" 1>&2 exit 1 elif [[ -z "$COL" || ! -e "$COL" ]]; then - echo "$0: col not found" 1>&2 + echo "$0: col '$COL' not found" 1>&2 exit 1 elif [[ -z "$MAN" || ! -e "$MAN" ]]; then - echo "$0: can't execute man" 1>&2 + echo "$0: can't execute '$MAN'" 1>&2 exit 1 fi