EmbLogic's Blog

need of double square brackets..?????

#! /bin/bash

echo “enter string 1″
read str1
echo $str1
echo “enter string 2″
read str2
if [[ $str1 == $str2 ]]
then
echo $str1 and $str2 matched
else
echo $str1 and $str2 not matched
fi
exit 0

2 Responses to need of double square brackets..?????

  1. siddarth says:

    Kindly mention what kind of issue you are facing in this script?

  2. Simarpreet Singh says:

    if i put only single square brackets in if statement, and pass hello hello in a single string and other hell hell in second string… it doesnt make make any comparison.. in short, it doesnt compare with space .. but when i put double square brackets [[]] ..it works fine .. whats the need of second brakets..

Leave a Reply to siddarth Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>