My code is:
#!/bin/bash
var="."
[ $var = "." ] && echo "Yup, it equals '.'"
exit 0
What prints:
Yup, it equals '.'
Debugged:
tpost@tpost-desktop:~$ /bin/bash -x ./foo.sh
+ var=.
+ '[' . = . ']'
+ echo 'Yup, it equals '\''.'\'''
Yup, it equals '.'
+ exit 0
You probably have a space in $var(or maybe $varempty?), Run it through /bin/sh -x ./yourscript.shto see what it actually compares.
, == - , Bash. , =, . , bash, , /bin/sh . = .