#!/bin/bash
echo "Enter any string"
read string
string1 = $(echo $string | rev)
if ["$string" == "$string1"]
then
echo "String is palindrome"
else
echo "String is not Palindrome"
fi
I am trying to check whether a string is a palindrome or not. Below is the error I get:
# ./palindrome.sh
Enter any string
mom
./palindrome.sh: line 5: string1: command not found
./palindrome.sh: line 6: [mom: command not found
String is not Palindrome
string1=$(echo "$string" | rev)
no spaces – Inian May 05 '20 at 14:31string1 = $(
=>string1=$(
– Hauke Laging May 05 '20 at 14:31