Correctly double-quote variables

Also remove useless use of eval and use `[[` instead of `[` (no matter which one you use, at least be consistent).