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.
Merge pull request #267 from darabos/patch-1

Let bash-template work when the directory contains spaces.