Use rmdir instead of rm -rf when possible
Determine and use the PATH for non-interactive shells

The script will now try to ssh to localhost to retrieve the PATH
of that shell, so that it can put the git-annex wrapper script
into that PATH if possible to ensure that git-annex works over ssh.