puzzling behavior after command editing
I keep hitting a problem on a Linux system where I'm running a certain shell script, it prompts for input, and I can't type anything. I've finally been able to reproduce my steps to get this to happen in a small script but I'm not sure if there's much I can do about the problem aside from not causing it to happen in the first place. Here's the script in question:
Looks pretty harmless, right? Here's what I do to execute it that can get me into trouble:
trap "echo 'quitter!!'; exit" INT
while [ "X$ans" != Xcontinue ]
echo "Enter 'continue' to continue..."
echo "Good job"
- Enable vi command editing (set -o vi)
- Type the letter v to launch vi on a temporary file in which I can enter a command to execute
- Type a command to execute the script. If the script is called prompter, I might just add ./prompter to the file
- Type the letters :wq to end the vi session and execute the command
At this point, some flavors of Linux let me type input for the script but some do not. I haven't tried it on a lot of different systems but two systems I have handy (one is CentOS and the other is SuSE) do not allow me to type input. I also have two others (Redhat and Ubuntu) which gladly accept the input.
Regardless of whether the system lets me type input to the script or how I end it, all of the systems leave me in command editing mode after the script completes. I have to hit Enter or use the vi commands a or i to type anything.
Has anyone else seen this, am I doing something blindingly stupid? :confused: