Starting with libreadline version 8.1, the default is to give special treatment to "bracketed paste" operations. This breaks parsing for my program, so I want to disable it.

I know that it can be globally disabled by adding this line to /etc/inputrc

   set enable-bracketed-paste off

I know that it can by disabled per-user by adding the same line to ~/.inputrc

I know that the command can be made program specific by modifying it to

   $if Progname
        set enable-bracketed-paste off

However those options require action by the sys admin or user. I want to have the program itself disable this mode on entry. The readline docs say rl_startup_hook is the address of a function to call just before readline prints the first prompt. I take this to mean that the following code should do what I want.

int my_readline_init(void) {
    char *command = strdup("set enable-bracketed-paste off");
rl_startup_hook = my_readline_init;

If I add a debug line or trace point to my init routine I can see that indeed it is being called. But (1) it is called on every input line, not just the first time, and (2) it does not have the desired effect. I.e. it does not turn off the bracketed paste handling. What am I doing wrong?

1 Answer 1


I eventually found this solution:

    rl_variable_bind ("enable-bracketed-paste", "off");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .