Previous Section  < Day Day Up >  Next Section

2.1. Enabling Command-Line Editing

bash initially starts interactively with emacs-mode as the default (unless you have started bash with the -noediting option;[2] see Chapter 10). There are two ways to enter either editing mode while in the shell. First, you can use the set command:

[2] -nolineediting in versions of bash prior to 2.0.

$ set -o emacs

or:

$ set -o vi

The second way of selecting the editing mode is to set a readline variable in the file .inputrc. We will look at this method later in this chapter.

You will find that the vi- and emacs-editing modes are good at emulating the basic commands of these editors, but not their advanced features; their main purpose is to let you transfer "keyboard habits" from your favorite editor to the shell. fc is quite a powerful facility; it is mainly meant to supplant C shell history and as an "escape hatch" for users of editors other than vi or emacs. Therefore the section on fc is mainly recommended to C shell users and those who don't use either standard editor.

    Previous Section  < Day Day Up >  Next Section