better implementation without cd hooks for #223

- trap for bash
- preexec_functions for zsh