mysqlbashredisreadlineeditline

Is there any WORDCHARS alternative in Bash?


Conculusion:


In zsh, WORDCHARS controls the behavior of C-w when deleting a word. Is there any alternative in readline?

I've noticed recently the behavior of C-w in mysql/redis-cli differs that in Bash, although both of which depends on readline?

Take string foo:bar as an example, only bar is deleted by C-w in Bash. While in mysql/redis-cli, the whole word foo:bar is deleted.

How do I control this behavior?


Solution

  • There are two commands to do backward kill word :

    backward-kill-word
    unix-word-rubout
    

    backward-kill-word deletes bar, unix-word-rubout deletes foo:bar

    Run following command to find out what C-w is bound to

    bind -P | grep C-w
    

    Seems bash doesn't have WORDCHARS as in zsh