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
> What do you think about using xargs -0 instead of sed?


That is what I originally thought of doing, however getting the \0 out of the grep and/or cut commands isn't that easy. So I chose to use sed to just get out the entire path.