fix detecting scripts base in zsh, fix #2444, update #2434