map jj to Esc in inputrc (readline)

You should rearrange the inputrc so the commented line comes after set keymap vi-insert. Like this: set bell-style none $if mode=vi set keymap vi-command “gg”: beginning-of-history “G”: end-of-history set keymap vi-insert #notice how the “jj” movement is “jj”: vi-movement-mode #after ‘set keymap vi-insert’? “\C-w”: backward-kill-word “\C-p”: history-search-backward $endif

Run interactive Bash with popen and a dedicated TTY Python

This is a solution to run an interactive command in subprocess. It uses pseudo-terminal to make stdout non-blocking(also some command needs a tty device, eg. bash). it uses select to handle input and ouput to the subprocess. #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import select import termios import tty import … Read more

How does “(head; tail) < file" work?

OS X For OS X, you can look at the source code for head and the source code for tail to figure out some of what’s going on. In the case of tail, you’ll want to look at forward.c. So, it turns out that head doesn’t do anything special. It just reads its input using … Read more

Is there a good way to replace home directory with tilde in bash?

I don’t know of a way to do it directly as part of a variable substitution, but you can do it as a command: [[ “$name” =~ ^”$HOME”(/|$) ]] && name=”~${name#$HOME}” Note that this doesn’t do exactly what you asked for: it replaces “/home/alice/” with “~/” rather than “~”. This is intentional, since there are … Read more

Why do I get “/bin/sh: Argument list too long” when passing quoted arguments?

TL;DR A single argument must be shorter than MAX_ARG_STRLEN. Analysis According to this link: And as additional limit since 2.6.23, one argument must not be longer than MAX_ARG_STRLEN (131072). This might become relevant if you generate a long call like “sh -c ‘generated with long arguments’”. This is exactly the “problem” identified by the OP. … Read more

Where to find Bash release notes or changes

From Bash website you can download “Bourne again shell (BASH)”. Inside the download you can find the release notes. EDIT: Or browse the source online, see NEWS for the summaries, and CHANGES for details. For patch releases, these could be useful: https://ftp.gnu.org/gnu/bash/bash-4.4-patches/ https://ftp.gnu.org/gnu/bash/bash-5.0-patches/ https://ftp.gnu.org/gnu/bash/bash-5.1-patches/ https://ftp.gnu.org/gnu/bash/bash-5.2-patches/