Bash : Compare Strings With Spaces
Submitted by khairie on Tue, 06/15/2010 - 13:01
To compare two strings that contain spaces in bash, enclose them with a double quote (e.g. "$VAR" ). Example below:-
if [ "$VAR" == "this is a string with spaces" ] then # do something fi
Reference: http://hacktux.com/bash/string
Recent comments
14 weeks 5 days ago
1 year 4 days ago
1 year 4 weeks ago