GNU Readline is a library for command line edition, used by bash and some other programs

learn more… | top users | synonyms

0
votes
0answers
4 views

Is it possible for bash/readline to “clean up” completion suggestions out the terminal?

If you are using zsh and do a tab completion for commands, pathnames, options etc, whenever there are multiple potential matches the suggestions will be displayed below the prompt. Once you chose a ...
2
votes
2answers
33 views

What is the gnome-terminal ANSI escape sequence for “CTRL + arrow/s”?

I am trying to configure my bash ~/.inputrc to these settings (Note: ←, → mean the left and right arrow keys) Ctrl + ← - should jump back a word Ctrl + → - should jump forward a word Currently I ...
1
vote
1answer
47 views

Implement a shell in a bash script [closed]

I am trying to emulate a shell in a bash script, like this: cmd_shell() { while true; do read -e -p 'pass> ' command run_cmd $command done } It works ok, and the option ...
1
vote
1answer
42 views

Using bind to read the current command line

I'm using bind -x to execute a script whenever a certain key sequence is pressed. For example I have a script at /usr/local/bin/foo with the contents #!/bin/bash echo foo If I run bind -x '" ": ...
2
votes
1answer
32 views

Readline: Binding an ANSI escape sequence to a key

I would like to bind a key with bash / readline, to clear the bottom of my console screen. The ANSI sequence to clear the bottom of the screen is \e[J, so I tried to add the following line to my ...
2
votes
0answers
44 views

readline - use of modifiers other than control and meta

I'm trying to use Apple's ⌘ command and ⌥ option keys to map some functions in readline to no avail. As per the man page I used octal values but that doesn't seem to work \xHH the eight-bit ...
2
votes
0answers
26 views

readline - yank resets set-mark

I want to implement this binding "\C-xk": kill-region # turn previous word into HTML/XML # opening and closing tag pair "\C-xh": "\e \eb\C-xk<\C-y>\e </\C-y>\C-x\C-x" but it returns to ...
6
votes
2answers
232 views

How to display control characters (^C, ^D, ^[, …) differently in the shell

When you type control characters in the shell they get displayed using what is called "caret notation". Escape for example gets written as ^[ in caret notation. I like to customize my bash shell to ...
6
votes
1answer
101 views

Change in bash prompt depending on whether first character is a space

Right now every command which starts with a space character gets ignored by bash history (HISTCONTROL=ignoreboth in ~/.bashrc). I would like to have a better visual cue when I press space as the first ...
2
votes
2answers
73 views

Why does “shift-tab” result in “Escape” in the terminal?

I just noticed this by accident. I use the vi readline mode (run set -o vi in bash) so it is particularly noticeable; in emacs readline mode I don't think Esc does anything, but in vi mode it exits ...
5
votes
2answers
47 views

How can I make readline add pre-“typed” text on terminal startup?

By pre-"typed", I mean the interactive console has code text waiting for the user to (edit and) run by simply pressing enter. It looks like something readline should support, but a confirmation that ...
1
vote
0answers
44 views

paste clipboard text plus string with .inputrc

I've got in my .inputrc something like "\C-v": "script.sh " I use a link from my clipboard as a parameter for the script, so I type ctrl-v and then paste the link, and then hit enter. So I've seen ...
-2
votes
1answer
41 views

Script To Update Multiple Hostnames

Needing a script to read row by row, then ssh into the machine and update the hostname of the machine, then exit and continue with the next row. We have a cvs file that contains the previous hostname ...
2
votes
1answer
54 views

How do I convert inputrc settings to bashrc ones?

I'd like to keep my modifications to as few files as possible, so I don't want to touch .inputrc unless I absolutely have to. So, given .inputrc lines like: "\e[5~": history-search-backward "\e[6~": ...
10
votes
1answer
382 views

Why does bash link to ncurses?

I think I've noticed this before but never thought about it much; now I'm curious. > ldd /bin/bash linux-vdso.so.1 => (0x00007fff2f781000) libtinfo.so.5 => ...
0
votes
0answers
39 views

reverse-i-search (Ctrl-r) with history -r?

I'm searching a way to reload the bash history before executing "Ctrl-r" command. Or better, complete using the .bash_history instead of the in-memory dump. Every Terminal has its "own" history but ...
1
vote
1answer
43 views

Some characters are filtered in bash

I'm currently running a Xubuntu image using VirtualBox and a strange issue just started occurring: I cannot enter a or c in a terminal or terminal emulator. A and C (that is, a/c + left/right Shift or ...
5
votes
1answer
239 views

How to have type-ahead apply to bash history search (Ctrl-R)?

Context Typeahead in bash: good When a bash shell is busy (initializing, running a command), one can type before the next prompt appears. If the shell has launched a program, that program will ...
0
votes
0answers
34 views

readline emacs equivalent to vi's 'fc'

In vi readline, I can use the command fc where c is a character I want to find and jump to in the current line. E.g. echo 'hello world' fw --------> Is there an equivalent command in emacs mode? ...
0
votes
1answer
42 views

Keys in the keyboard are not functioning in an interactive script!

I am using this code in bash to make my script interactive. What I mean by interactive is to let the script ask me questions such as what is the path to my data: #!/bin/bash -ef read userInput if [[ ...
1
vote
1answer
135 views

bash/gnu readline multiline command: move row up/down

How to move one editing row up (back) or down (forward) in a multi-line command in bash/readline? Somethnig like gj/gk in Vim.
0
votes
1answer
158 views

inputrc not loading correctly

I added the following to my ~/.inputrc: set show-all-if-ambiguous on # single tab to start completion help set completion-ignore-case on # completion is case-insensitive $include /etc/inputrc ...
4
votes
0answers
115 views

Bash command not found due to stray garbage characters

What is the cause of this behavior? $ cd ../ $ bash: $'\210\210cd': command not found This happens sometimes (rarely) when I enter a command, there is no visible character preceding the cd, still ...
1
vote
0answers
56 views

Clear the terminal in “vi” mode? (equivalent of “ctrl+l” from “emacs” mode) [duplicate]

I am aware of Ctrl+L on bash terminal (using it on Ubuntu) which clears the screen by applying appropriate scrolling on bash terminal. After learning that the terminal is by default set to emacs mode ...
1
vote
1answer
61 views

How can I change readline settings on keypress?

I checked docs for readline (in man bash), and I can't find a way to solve one problem: how to change readline setting (set ... on/off) on keypress? Keybindings seem to have form: key:function or ...
1
vote
1answer
58 views

bash show-all-if-ambiguous turns on spontaneously

I am using tmux and bash. I find that, at seemingly random intervals, my running shells have show-all-if-ambiguous set to on. This is a significant annoyance to me, since many of my operations are in ...
2
votes
0answers
68 views

Are there any command line IRC clients that use readline?

I'm currently using irssi as my irc client, which is ok, mostly, but there are a couple of things that would make the chat experience better: readline support -- the ability to use vi key bindings ...
5
votes
2answers
338 views

Bash displays international characters as escape sequences

When I press certain keys (e.g. German umlauts) in the bash command line, I get escape sequences. For example, ß gives me \303. These escape sequences are treated as single characters, so one ...
5
votes
3answers
269 views

How to undo changes in the commands-history?

In UNIX systems you can press top and bottom arrows to navigate through the previous commands. This is extremely handy. Sometimes, I go up and find a command that I want to use again, but with some ...
4
votes
2answers
84 views

Coming back to a command I have partially written [duplicate]

Often I find myself partway through writing a long command (or chain of commands) and realise I need to run another command before I can finish typing out this current one. Examples Sometimes, I... ...
1
vote
1answer
159 views

Enable cursor keys in python shell over ssh

I run OpenElec on a Pi. I can ssh to the Pi and open a python shell. How do I enable the cursor keys to work like up getting to last command in the python shell, like it does on my Ubuntu box. Now ...
2
votes
2answers
153 views

How do I swap the two last command line arguments?

$ ln -s ./dir/target.txt /path/to/source.txt{cursor here} How do swap file typed filenames in command line? Alt+T swaps words, not filenames, resulting in ln -s ./dir/target.txt /path/to/txt.source. ...
2
votes
1answer
435 views

Strip newline from piped input

I've been setting up a script to work with haste-server. This takes piped or file input (tail /var/log/messages | haste and haste < /path/to/file.txt) and submits it to the server which then ...
5
votes
1answer
177 views

Remap Return key in terminal to prevent accidental command on productions servers

I am looking for a way to remap the key for executing commands in terminal (I am using bash) to prevent accidental commands on productions servers. Return should be disabled. I tried the following ...
4
votes
3answers
138 views

Deleting input forward to the next space

When in terminal I can use Ctrl+w to delete a whole word or IP (. is separator for each octet) when going leftward of prompt. However, if I try Alt+d to go rightward of prompt, terminal recognizes "." ...
5
votes
2answers
46 views

Is it possible to (re)define what readline (embedded in bash) defines as a word?

Many of the special Readline constructs allow the user to edit the command line in various ways. For instance, certain keystrokes allow moving forward a word. A word is defined to be what bash itself ...
2
votes
1answer
162 views

readline - why does does it only do carriage return and not a line feed when reaching end of line?

I developped a python application that uses the cmd module to make an interactive command-line interface. This cmd module uses readline for command-line management: completion, history... My issue ...
4
votes
0answers
185 views

Assign both menu-complete and dynamic-complete-history to TAB

Is there a way for me to assign both menu-complete and dynamic-complete-history to Tab (or one to Tab and the other to Tab-Tab) in .inputrc? I'm thinking there might be a way to setup a function and ...
3
votes
1answer
629 views

What are the bash shell length limitations for here-docs?

What are the length limitations for using here-docs as part of bash command lines? I am finding that short here-docs work fine, but when they get longer there is some point or structure after which ...
0
votes
2answers
182 views

Is one bash shellshock fix tar file for SLES bad?

SERVER:/home/user # rpm -Uvh --test readline-5.1-24.4.7406.0.PTF.898762.i586.rpm warning: readline-5.1-24.4.7406.0.PTF.898762.i586.rpm: V3 DSA signature: NOKEY, key ID b37b98a9 error: Failed ...
1
vote
1answer
217 views

Custom tab-completion in bash's `read`

Is there a way to "import" a list of words into bash's read builtin to have custom tab-completion? I've been writing a wrapper script for suckless' minimalist irc client "ii", and I don't have a way ...
3
votes
1answer
171 views

Control-p freezes SSH session

I have encountered a strange situation on one of my SSH ARM machines I use on a daily basis. Every time I connect to the server and press Ctrl+P to invoke previous-history BASH function SSH connection ...
1
vote
3answers
627 views

~/.inputrc file not sourcing correctly

I have this ~/.inputrc file that I created for certain key bindings. # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving "\e[1;5C":forward-word "\e[1;5D":backward-word ...
3
votes
3answers
255 views

confusing behavior of emacs-style keybindings in bash

Bash offers many useful emacs-style keybindings for simple commandline editing. For example, Ctrl+w deletes ("kills") word left from the cursor. Another keybinding, Alt+d is supposed to be a "mirror" ...
1
vote
1answer
98 views

How to provide a customized function 'complete' to readline of socat

Is this possible to provide a customized 'complete' function to the readline library that goes inside socat? I mean something quicker than recompiling the readline, some hook or text file ...
6
votes
1answer
248 views

Highlighting text in bash when using reverse history search using Ctrl-R

Using Ctrl-R, I can search the history in bash. But what to do, If I want to highlight the relevant word which has been typed upon by me. Example: (reverse-i-search)`mount': sudo mount /dev/sda2 ...
2
votes
1answer
630 views

bash not reading $TERMINFO on login (over SSH)

I have a OpenVZ Fedora 20 VPS that when I SSH into, my termcap file stored in $XDG_DATA_HOME/terminfo/x/xterm-termite, isn't being read, despite having TERMINFO=$XDG_DATA_HOME/terminfo set. If I ...
1
vote
1answer
110 views

How to turn on all default binding keys of vi-editing-mode on bash?

I am using vi-editing-mode on Bash. According to man readline, there are a couple of default binding keys working on vi-editing-mode. Some keys work well, but some other default keys do not work. ...
1
vote
1answer
804 views

Is it possible to change the key binding for completion in bash shell?

For bash, I would to modify the tab key for completion to the escape key. I know that key bindings are defined in /etc/inputrc. But I don't know if something like this could work: `"\e" : ...
6
votes
4answers
2k views

How do I switch to vi editing mode in readline?

I want to switch to vi editing mode in a readline environment. But I don't want to use 'set -o vi'. I want to temporarily switch using a keyboard shortcut. The man page says I can do this with ...