Resolves issue where z mydir/ fails even when mydir exists
Shell built-in directory tests can fail when paths have trailing slashes. This fix strips trailing slashes before the directory test while preserving the original path for cd.
Changes: Fish, Bash, Zsh, POSIX, and Tcsh templates now strip trailing slashes before directory tests