Kod: Zaznacz cały
#!/bin/bash
S1='string'
S2='Stringn'
if [ "$S1"="$S2" ]
then
echo "S1('$S1') is not equal to S2('$S2')"
fi
if [ $S1=$S1 ];
then
echo "S1('$S1') is equal to S1('$S1')"
fi
Kod: Zaznacz cały
#!/bin/bash
S1='string'
S2='Stringn'
if [ "$S1"="$S2" ]
then
echo "S1('$S1') is not equal to S2('$S2')"
fi
if [ $S1=$S1 ];
then
echo "S1('$S1') is equal to S1('$S1')"
fi
Kod: Zaznacz cały
#!/bin/bash
#==========================================
# condition and string comparison
#==========================================
S1='name'
S2='Name'
if [ $S1 == $S2 ]; # NOTE [with spaces]
then
echo "$S1 == $S2";
else
echo "$S1 != $S2 ";
fi