From 0d0e9031d0f11fc46b81385b5b9ba2725ecec61b Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 24 Dec 2021 04:52:38 +0100 Subject: [PATCH] Fail on invalid selection --- home/.local/bin/scripts/cheat.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/.local/bin/scripts/cheat.sh b/home/.local/bin/scripts/cheat.sh index ac659c9..f7c8559 100755 --- a/home/.local/bin/scripts/cheat.sh +++ b/home/.local/bin/scripts/cheat.sh @@ -11,6 +11,10 @@ if [ -n "$1" ]; then fi else selected=$(printf "$SELECTABLE" | fzf) + if [ $? -ne 0 ]; then + echo "Invalid selection: '$selected'" + exit 1 + fi selected=$(printf "$selected" | tail -1) fi