To input a line of text comfortably under zsh, use
vared instead of
read invokes zle, which is the equivalent of passing
-e in bash to invoke readline.
vared -p 'What would you like to do?: ' -c tmp
The behavior you describe with plain
read looks like a misconfigured terminal rather than a shell issue. Run
stty -a to show your terminal settings, and make sure that
eol is set to
erase is set to what your Backspace key sends. Depending on the operating system and how it's set up and on the terminal, Backspace sends either
^?. The backspace setting usually goes wrong because of some configuration file that tries to set it manually, so the first thing you should do is track and remove any such misconfiguration. If you find none, review your terminal emulator's settings to check that it isn't set into some historical compatibility mode. If all else fails, add something like this to your
if [[ $(ps -o comm= $PPID) = iterm ]]; then
stty erase '^?'