linux - checking if a string is a palindrome -
I'm trying to check if a string is a pilot in a bull. Here is where I came with:
#! / Bin / bash read -p "Enter a string:" string if [[$ string | Rev == $ string]]; Then echo "Pyrenothrome" Fi , now resonate $ string | Rev gives the following string, my argument was in condition for this
So, how can I store "return value" in a variable from rev ? Or use it directly in any condition?
without another change : inside and unnecessary Excerpt: <[...]]
#! / Bin / bash read -p "Enter a string:" if the string [[$ (REV << lt; $ string) == "$ string"]]; Then resume the Pyramondrome F
Comments
Post a Comment