From aa21d92b56e17cb8577b8b6a9233bd4c61fa5005 Mon Sep 17 00:00:00 2001 From: "David J. Malan" Date: Tue, 2 Jul 2024 19:08:16 -0400 Subject: [PATCH] detecting miscapitalized commands --- opt/cs50/lib/help50/bash | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opt/cs50/lib/help50/bash b/opt/cs50/lib/help50/bash index 796d8c6..defd38b 100755 --- a/opt/cs50/lib/help50/bash +++ b/opt/cs50/lib/help50/bash @@ -29,6 +29,13 @@ if [[ "$output" =~ $regex ]]; then exit fi + # If uppercase + argv0="${BASH_REMATCH[1],,}" # Lowercase it + if command -v "$argv0" &> /dev/null; then + echo "Did you mean to run \`$argv0\`, in lowercase instead?" + exit + fi + # If backslash instead of forward slash if [[ "${BASH_REMATCH[1]}" =~ ^\.(.*) ]]; then if [[ -f "./${BASH_REMATCH[1]}" ]]; then