7

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 defines it to be.

Is it possible to set bash parameter(s) so that Readline defines a word to be something different other than what bash normally defines it to be? Say, any sequence of non-whitespace characters?

  • 1
    No, but in bash, you can [define functions that behave like readline's except for a different notion of word](http://unix.stackexchange.com/questions/150578/confusing-behavior-of-emacs-style-keybindings-in-bash/150591#150591). – Gilles 'SO- stop being evil' Dec 04 '14 at 23:27

2 Answers2

2

As far as I know, the definition what is a word depends on the current locale settings.

The readline man page (bash uses readline for input handling) says:

Words are composed of alphanumeric characters (letters and digits).

jofel
  • 26,513
  • 6
  • 65
  • 92
-1

Bash splits words by the $IFS variable, see https://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html.

Note, that word selection (i.e. by doubleclicking the word) is configured in your terminal's settings.

allo
  • 916
  • 1
  • 7
  • 13
  • That is *not* the same way Readline splits words. For example, `backward-word` will move to a hyphen within a word, but that's not part of `IFS`. – l0b0 Apr 16 '20 at 23:49