Submitted Questions

  • Write a shell script to identify the given string is palindrome or not?

    armaan mahajan

    • May 22nd, 2017

    #!/bin/bash

    echo "please enter the string"

    read string

    string_new=$string

    reverse_string=`echo $string|rev`

    if [ $reverse_string -eq $string_new ];

    then

    echo "String is palindrome"

    else

    echo "string is not palindrome"

    fi

    sujit kumar

    • May 4th, 2017

    #!/bin/bash
    echo -n "Enter a string: "
    read str
    if [ $(echo $str | rev) = $str ]
    then
    echo "$str is palindrome."
    else
    echo "$str is not palindrome"