Let bash-template work when the directory contains spaces.

I think the important part is just the first two diffs. The rest may be unnecessary, but I think makes the behavior clearer.