if statement - Test for a dot in bash -


how can test if string dot in bash? i've tried this:

if [ "$var" = "." ] 

and this:

if [ "$var" = "\." ] 

but doesn't work.

works me:

$ d=. $ if [ $d = '.' ];then echo 'yes'; else echo 'no'; fi yes $ d=foo $ if [ $d = '.' ];then echo 'yes'; else echo 'no'; fi no 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -