set-option

emacs shell option

Selects Emacs-style Readline command-line editing. Ctrl-A moves to the start of the line in the usual Emacs keymap; user inputrc bindings may differ. The pseudo-terminal fixture inserts text at the beginning before executing the corrected command. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Use interactive Bash with default key bindings; expected visible result: edited.

Formal Syntax & Structure

bash syntaxbash
set -o emacs; set +o emacs

Return Value

exit status

Returns zero on success and nonzero on failure; option queries return zero when enabled.

Working Example

Example Snippetbash
# In a fresh interactive Bash, enter:set -o emacs# Type: 'edited\n' (without Enter), Ctrl-A, then printf followed by a space, then Enter.
Bash Reference