Quote the sub shell return value, and provide a comparable default of X`

This should fix "sh: line 1994: [: !=: unary operator expected]". Fixes #302.