Web lists-archives.com

Re: Bash-Problem with cursor position after calling a function with READLINE_LINE

Am Freitag, 7. September 2018 schrieb Norbert Gruener:
> Hi Stefan,
> >>    bash^[[D^[[C^[[B^[[A
> >
> > This reminds me of programs (ed, rcs, telnet etc.) which don't use
> > readline and have less command line editing capabilities. Backspace
> > should work, though.
> It is exactly my impression too.  But I could not find any hint why the
> »command line editing « should be deactivated in that case.

Maybe, just maybe... ;-) the cause lies in what you use as a shebang in your 
script. If I do:
$ sh
I get a dash subshell on my system which has apparently no command line editing 
with readline configured and I get the cursor movement sequences printed 
instead of being translated/executed by the terminal.

On the other side changing the shebang to "#/bin/sh" instead of "#/bin/bash" 
didn't change the behaviour of that little script with the bound F1 key, works 
just as before...

Kind regards,