palindrome.bash: initial commit

This commit is contained in:
Aminda Suomalainen 2024-04-15 09:54:12 +03:00
parent 9437d3fa56
commit ba3e15cbcb
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
1 changed files with 13 additions and 0 deletions

13
bash/palindrome.bash Executable file
View File

@ -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