From ba3e15cbcbbd21f76cc4b0df6760d06d4e0f6caf Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Mon, 15 Apr 2024 09:54:12 +0300 Subject: [PATCH] palindrome.bash: initial commit --- bash/palindrome.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bash/palindrome.bash diff --git a/bash/palindrome.bash b/bash/palindrome.bash new file mode 100755 index 0000000..52a2344 --- /dev/null +++ b/bash/palindrome.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +while true; do + # Neovim complains about mangling backslashes if -r is not specified and + # I have learned to listen to its warnings + read -rp "What would you like to check for a palindrome?: " inputted + reversed=$(echo "$inputted" | rev) + echo "$reversed" + + if [[ $inputted == "$reversed" ]]; then + break + fi +done