Discussion:
[Help-bash] How to execute multiple readline commands?
Michal Pesa
2018-07-28 11:58:42 UTC
Permalink
Hello,

I would like to execute multiple readline commands. For example the
following macro deleting the line and inserting "goto ":

"\C-x\C-d": "\C-a\C-kgoto "

Is it possible to use something like this instead:

"\C-x\C-d": beginning-of-line kill-line "goto "

As of now, it seems to me that I have to bind all the commands I would
like to use and then use them as a macro (unless I want the keystroke to
execute exactly one command).

Thank you for your time.

Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_$
uname output: Linux pish-lub 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17
15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.4
Patch Level: 19
Release Status: release
Chet Ramey
2018-07-29 22:30:18 UTC
Permalink
Post by Michal Pesa
Hello,
I would like to execute multiple readline commands. For example the
"\C-x\C-d": "\C-a\C-kgoto "
"\C-x\C-d": beginning-of-line kill-line "goto "
As of now, it seems to me that I have to bind all the commands I would like
to use and then use them as a macro (unless I want the keystroke to execute
exactly one command).
There is no way to execute named readline commands except binding them
to a key. If you want more than one command, you will need to use a macro.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU ***@case.edu http://tiswww.cwru.edu/~chet/
Loading...