scripts/bash/palindrome.bash

14 lines
337 B
Bash
Raw Normal View History

2024-04-15 08:54:12 +02:00
#!/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