"readline" initialization

I have used readline for years and not known a thing about it. There is usually the .inputrc in the home directory, which users are supposed to be free to change.

I am hoping to find a way of writing system-wide keyboard macros, to use wherever I happen to be in Fedora.

The man page for readline (I guess that is part of the copious bash man page), gives instructions on how to create keyboard macros. For example,

Control-b: "something AT email.com"

is supposed to work. If I press Control-b, readline is supposed to substitute my email address. It doesn’t. It may be that I am making some tiny mistake in editing ~/.inputrc, which I first created by copying the /etc/inputrc file to it.

In any case, if “readline” won’t work, is there any other way to create global keyboard macros, which I would find to be terribly useful.

Thank you again and I hope to hear from somebody soon.


1 Like

Execute bind -p | grep "\\C-b" (yes, ESC char) & note it’s the backward-char. Use “\C-b” to replace with email address: not Control-b. I recommend a different key-binding if using emacs mode. Find a key not in use such as “\C-x\C-w\C-w”. Try this in “~/.inputrc”:

$if term=linux
"\C-x\C-w\C-w": "This is a linux console!"

Execute bind -f ~/.inputrc or “\C-x\C-r” (use 1st execution to read binding) to reload. Use Ctrl+Alt+Fn to enter a console, and execute “\C-x\C-w\C-w”.

Particularly for uninitiated, for global anything, don’t alter /etc/* such as /etc/inputrc, /etc/bashrc, etc. Put all changes in each USER inputrc (similar to global).
Of the variables listed in bash(1) is “comment-begin”. In “~/.inputrc”, enter
set comment-begin "# TEST--> ". Now in terminal, enter “uname” & then “ESC+#”.

I recommend a practice inputrc (e.g., call it ~/.inputrcEG). Practice with the variables listed in bash(1) in this file.

Welcome to the community, @bryguy ! Please take a minute to go through the posts in #start-here if you’ve not had a chance to do so yet. I’ve edited your post to replace your e-mail address, by the way.

@ptrck4193: please edit your answer to use the formatting tools, especially the code-formatter. Otherwise, any one copy-pasting your commands will run into trouble because they are not currently rendered in plain-text ascii that most shells require them to be in. For example, " is not always the same as "—the former will be unicode while the latter will be the required plaintext.