Fix atom.sh when running from directory with space

Deal with ATOM_PATH having a space by proper quoting, and not passing
the directory name to dirname.

Fixes atom/atom#4336
> however getting the \0 out of the grep and/or cut commands isn't that easy. 

I'm not sure what you mean by this, you are saying it still failed for certain cases when using `-0`?