Web lists-archives.com

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




Hallo Norbert,

Am Donnerstag, 6. September 2018 schrieb Norbert Gruener:
> Hi all,
>
> In my Bash shell (».bashrc«) I have »bind« a command to the »F1« key
>    bind -x '"\eOP":"_bash_man"'        # F1 man <command>
>
> The script »_bash_man«  looks like (it is simplified only for test reasons)
>
>    echo "${READLINE_LINE}"

I tried exactly that and it seems to work. I put only that one line in a script, 
assigned the F1 key with bind to it and it outputs just the string I typed 
before when I hit F1 like intended. No problems with cursor movements, 
backspace and any other command line editing.

I'm on Devuan ascii and run GNU bash, Version 4.4.12(1)-release 
(x86_64-pc-linux-gnu)

>    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.

M2C

Kind regards,
Stefan Krusche