Quote variables for comparison.

There appears to be less tolerance in some versions of bash, so quote variables
in various places before comparing.

Noted by Laborie Vincent.