I have two strings
a=Mar22
b=may21
how can I compare them
Is this fine
if[ $a -eq $b ] then;
.
...
else
....
fi
or
if[ $a = $b ] then
I have two strings
a=Mar22
b=may21
how can I compare them
Is this fine
if[ $a -eq $b ] then;
.
...
else
....
fi
or
if[ $a = $b ] then
for string comparisions we generally use = operator.
-eq is used for integer comparisons.
if [ "str1" = "str2" ] then
fi
will do your task .
Many Thanks.It worked now. I tried with out " ".