Fix a bug when a non-directory is in the path

If a path in $PATH points to a file or symlink, jash would crash
trying to list the contents.  This fixes that.