I confirmed that this works with both bash and zsh.
Fix error in zsh when symlinking to sub from _SUB_ROOT
This doesn't work for me when I'm trying it in our 37 sub, which I have in ~/.37.
/Users/qrush/.37/bin/37: line 13: cd: .//Users/qrush/.37/bin: No such file or directory
37: no such command `init'
Re this comment on #23:
"Nevermind. My pull request breaks sub-init. Could you please explain why abs_dirname() is the way that it is? Is there a reason some combination of dirname and basename is insufficient?"
I'm not too sure. Maybe @sstephenson knows?