Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [readline]

GNU Readline is a library that provides command-line editing and history searching capabilities for Bash and other interactive command-line programs. Use this tag for questions relating to the use of Readline functionality in Bash and other software.

0
votes
0answers
27 views

Mimic command on Linux

I find it really useful when using osx to have the Control key freed up to use emacs-like shortcuts in most applications, but in Linux it tends to be used for shortcuts instead. Is there a way to ...
3
votes
1answer
38 views

Using multiple copy buffers in Bash

Ctrlu cuts text from current location to the beginning of line. Now, I can paste this with Ctrly whenever I want until the next time I hit Ctrlu to copy another line in the buffer. Now the problem I ...
0
votes
0answers
10 views

`~/.inputrc` vi editing mode with emacs shortcut keys, `Control-e: end-of-line` not working

I am using Debian 9 with the Bash shell as default. This is my ~/.inputrc file. set editing-mode vi set show-mode-in-prompt on set vi-ins-mode-string "+ " set vi-cmd-mode-string "- " # in vi-command ...
0
votes
1answer
28 views

How to clear the screen from command line in GAP

Normally I can clear the screen with ctrl-L but while running GAP, ctr-l just displays the last command entered.
0
votes
0answers
28 views

bash COMPREPLY with custom colors

Is there a way to have a COMPREPLY return colored output? I can get it to work when readline recognizes the output as a folder when I have bind "set colored-stats on", but I can't make my own colors. ...
0
votes
0answers
11 views

Ctrl-Y yanking in Node repl doesn't work

I like interactively working in a REPL, so I was a bit confused when firing up Node's node process and seeing that all the readline shortcuts I usually use worked as normal, except yanking with Ctrl-Y....
0
votes
2answers
51 views

Text from standard input not visible after program exits from a readline

I am facing an issue where the text from my stdin is not visible from on my terminal. My program does the following Sets a SIGALRM handler which exits a program when there is no input from the user ...
0
votes
1answer
650 views

How to get PHP 7.1 to use libreadline.so.8?

After an update of my Manjaro system, my PHP server stopped working, with the error "php: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or ...
0
votes
2answers
100 views

How to make Readline in vi mode to read .vimrc?

When using Readline's vi mode in Bash, I can use command v from normal mode, to open the current command line in Vim for editing. However, in this case, Vim does not read my ~/.vimrc file, so none of ...
1
vote
2answers
67 views

Why is my readline / .inputrc configuration being ignored?

I have a configuration line in my .inputrc: set enable-bracketed-paste on # Insert paste as a string rather than possibly running it This is valid when typed at the command line: bind 'set enable-...
0
votes
1answer
96 views

Input from readline owerwrites the prompt

So I'm trying to create an interactive bash script, where i can call given options from 1-n or just them like commands. It will end up with a simulated prompt and 'read' is used to get the input, ofc....
-1
votes
2answers
49 views

What does “set keymap vi” actually do?

In an effort to vim-theme Readline, I see there are two set editing-mode vi set keymap vi I believe I understand what editing-mode vi does providing different VIM keymaps to edit, and insert text ...
0
votes
3answers
59 views

Shell - Print values in a comma separated string

I have a txt file with some comma separated values. cat file.txt abc,def,ghi abc,ghi def,abc,ghi def,abc abc,def abc,def,ghi I want to print these values with while do read line from file separated ...
0
votes
0answers
34 views

How to bind a key in bash to a function that modifies the current command line

This is an extension to: https://stackoverflow.com/questions/4200800/in-bash-how-do-i-bind-a-function-key-to-a-command. I am looking for a way (through bash and/or readline) to bind a key to a ...
0
votes
1answer
50 views

readline keybindings in chrome/chromium

Does a chrome/chromium extension exist that can configure often used readline keybindings? Specifically Ctrl+a for Home, Ctrl+e for End, Ctrl+d, etc for use within a text editing box. I have found ...
0
votes
1answer
37 views

prompt (PS1) doesn't update on bound command

I don't understand why these two different ways to use the same command lead to different behaviors. I've installed fzf and fd and have the following lines in .bashrc function updir(){ cd .. } ...
0
votes
1answer
38 views

Tab auto-deletion at command line

Running Ubuntu 18.04 and using bash. So I am aware of how to use tabs at the command line to auto-complete the next token with file paths and what have you. Question: is there an easy shortcut for ...
0
votes
0answers
79 views

how to make `.inputrc` keybindings to work on commands that are using `read`?

I have this snippet in my .inputrc to map jj as enter/return. "jj": "\C-M" It works well but not for commands that are using read, for example entering passwords. How can I make this to also work ...
2
votes
1answer
38 views

Generate brace expansion from list of files

This brace expression will generate a list of files: $ touch {foo{.t,t.t},other.txt,test{,.{ascii,t{est.qt,x{t,xt}}}}} $ ls foo.t foot.t other.txt test test.ascii test.test.qt test.txt test.txxt ...
2
votes
1answer
78 views

bash in-line brace expansion

Does bash/readline have a binding or a function that a key combination can be binded to in order to expand in-line braces? Similar to the way M-* key combination can be used for in-line globbing ...
1
vote
2answers
193 views

How can I permanently correct a typo in my last bash command?

It's not uncommon that I make a typo when entering commands in my bash interactive shell. I'd like to be able to correct the typo in my bash history so that the incorrect command does not pollute it ...
0
votes
1answer
65 views

Rlwrap vi-movement-mode does not work with some programs

With rlwrap cat or rlwrap bash I can use keybinding "jk" to exit from insert mode. This does not work with rlwrap ghci. Why?
1
vote
1answer
39 views

What are bindable variables?

Reading Bash-4.4 Release Available, I noticed the following sentence. There is a new bindable variable, `colored-completion-prefix', which, if set, causes the common prefix of a set of ...
5
votes
2answers
539 views

Is there a way to define a bash readline command? [closed]

I can not find a way to do that from bash. So Is there a way to define a bash readline shortcut that will insert a dynamically generated string at the position of the cursor? E.g., I want to insert ...
0
votes
6answers
121 views

Replace counter field in large file with iterated value

I have a huge text file with about 70k lines in it. My objective is to read this file, match a pattern ("Count"), and add or replace its value with an iterated number. What I'm doing is : Reading ...
1
vote
0answers
37 views

How do I clear a suggestion from history-beginning-search-backward or history-beginning-search-forward?

How do I clear a suggestion when history-beginning-search-backward is invoked? For example: sudo vim #history-beginning-search-backward gets executed by a keybinding sudo vim /etc/hosts Once in ...
0
votes
1answer
610 views

SUSE Linux Enterprise - Python3 error with readline in /etc/inputrc

When I start a python3 shell on my machine, I get the following warnings: $ python3 Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) [GCC 7.2.0] on linux Type "help", "copyright", "...
1
vote
1answer
66 views

I can't print the default text in the Readline input

I am writing an interface to my database and would like to be able to edit entries. I thought I'd use Readline, but can't get it work. I'd say my code should work, based on Term::ReadLine::Gnu and ...
0
votes
1answer
43 views

Readline “Miscellaneous Commands” not found

In trying to read in my inputrc file, I was reading https://www.gnu.org/software/bash/manual/bashref.html#Miscellaneous-Commands: re-read-init-file (C-x C-r) Read in the contents of the inputrc ...
0
votes
0answers
36 views

How do I copy to clipboard text I cut with Ctrl+U? [duplicate]

In an interactive shell session, how do I copy to clipboard text that was cut with Ctrl+U? Without using the mouse, obviously. Thus making it available for other GUI applications, instead of pastable ...
-1
votes
1answer
681 views

reading output into variables inside the os.system command

I have a python script which runs in Linux. I need to capture a command's output and store into variables and then should print the output. Code below - #!/usr/bin/python import os, time systime=os....
1
vote
2answers
200 views

On backspace, `bash read -e` also deletes same-line printf (preexistent) text

I use printf "input: "; read -e. I type something then I press Backspace. When reaching the last character, this deletes the input: part together with it. Backspace doesn't misbehave if I hadn't typed ...
2
votes
1answer
973 views

The easiest way to clear scrollback buffer of terminal + some deeper explanation?

Why bother? Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer ...
-1
votes
1answer
54 views

Readline keymapping C-/ not working

I have the following line in my .inputrc which does not appear to be working: "\C-/": insert-comment When I press C-/ I expect the current line to be prefixed with the comment character (#) and ...
5
votes
2answers
1k views

Is there a POSIX shell alternative to read -e? [duplicate]

How can I achieve the effects of read -e (which turns on line editing via readline and is available in bash) from a general (POSIX) shell? I don’t want to lose POSIX compatibility just because of this ...
1
vote
1answer
108 views

printing and not executing the result of zsh history expansion on partial search

I could do: !systemctl:p to get systemctl reload bind result printed (as last command in the history starting with systemctl string). but doing the same with the partial search on the command ...
3
votes
2answers
154 views

Moving by whitespace-delimited word in bash/readline

In bash line editing (or in any program that uses GNU readline), Meta-f moves to the right by one "word" and Meta-b move to the left by one "word", where a "word" is composed of letters and digits. ...
3
votes
1answer
158 views

Question on variables in /etc/inputrc

In my /etc/inputrc file I have several set statements as noted below. Do all those variables belong to Readline ? How do I see the currently set values for those variables ? For bash variables I can ...
-3
votes
2answers
179 views

inter process comunication in bash read commands in multiple background functions

I'm trying to get the following code to read from a main input then read that in one function then be able to send that into the input of another function but i am having trouble getting it to work ...
3
votes
1answer
165 views

bind to string with escaped double-quotes

I'm trying to bind Alt-s to an SSH command that is quite complex and requires nested double quotes. bind '"\es":"ssh -t me@myserver \"echo \\"hi\\"; echo \\"bye\\"\""' But when I execute the ...
2
votes
3answers
273 views

How to prevent `rlwrap` from saving a password in an input history file?

I'm using the rlwrap utility inside the following shell alias: alias gp='rlwrap git push' The purpose of this gp alias is to be able to use basic line editing commands such as C-a or C-e to get to ...
3
votes
1answer
707 views

unbind default key from inputrc

What I want to do is made C-h not send backwards-delete-char there is nothing about it in my inputrc files but is shows up in bind -p
0
votes
1answer
804 views

Make zsh use readline instead of zle?

Is there a way to make zsh use readline reading /etc/inputrc and ~/.inputrc instead of zle module? I keep my command-line key bindings in inputrc to be applied globally to all other "shells" who use ...
0
votes
2answers
132 views

Shortcut for line continuation (escaped newline) action

Does exist the way, binding line continuation action to specific key in the bash? That is, instead pressing two keys \ and Enter, one after another, press two keys simultaneously, for example Alt + ...
0
votes
1answer
1k views

timeout causes while read loop to end when `cat` is timed out

I am unable to discern why timeout in a function call will cause a loop to stop. I have a "solution", but I am really very intrigued as to how / why this is happening! It seems to be something to do ...
3
votes
2answers
1k views

How to bind Ctrl+arrows/backspace/del to the Readline commands

I'm trying to make the following bindings in my ~/.inputrc: (Ctrl+Del): kill-word (Ctrl+Backspace): backward-kill-word (Ctrl+forward arrow): forward-word (Ctrl+back arrow): backward-word (Home): ...
0
votes
1answer
110 views

Bash/Readline vi line editing mode doesn't work in Screen

I have set -o vi in my ~/.profile, and it works fine on the regular console and under Tmux. But when I run Screen, if I press Escape or ^[, I get a visual bell, the next key I press seems to get eaten ...
1
vote
1answer
261 views

Length of readline mode string in bash prompt

How do I find the length of readline's mode string (eg @ or (cmd) or (ins)) which is printed in front of the bash prompt? This mode string is activated by set show-mode-in-prompt on in .inputrc. I ...
4
votes
2answers
165 views

readline: does non-incremental search offer anything that incremental search doesn't?

I use incremental-search (Ctl-r/Ctl-s) a lot in bash, and find it incredibly useful. I noticed Meta-p (Esc p) runs non-incremental search, and I'm curious what purpose it serves, given the existence ...
6
votes
1answer
131 views

Unexpected behaviour from Readline's bind command

I hadn’t yet researched whether or not bracketed paste mode is supported by the version of Bash/Readline on my Ubuntu 16.04 system (it isn’t) and out of curiosity, I ran the following command ...