This isn't clear to me. Are you using the Almquist Shell to execute BASH to run your script, or is BASH already running when the script is executed?
-- Sent from my iPad > On Sep 8, 2014, at 1:17 AM, Jan Rome <jan.r...@gmail.com> wrote: > > Hello, > > I'd like to report an obscure bug I came across in pfsense which runs on top > of FreeBSD. > > If I run a bash script in which I have > > read -r -n1 -p "prompt: " > > and instead of providing input, i ctrl-c the script, > > the ash shell doesn't recover the terminal properly; backspace echos ^? and > the only way to delete characters is to hold shift and press backspace. Also, > if I use the -s switch for the read command in the bash script, the problem > gets even worse with the cursor not moving anymore as I type and the text I > type not being visible at all. > > A solution was provided by pgas from #bash on irc.freenode.net, where I solve > this by trapping the ctrl-c signal and do 'stty cooked' before exiting, which > seems to give expected behaviour. > > Best regards, > > Jan >