Variable: shell-prompt-pattern

shell-prompt-pattern is a customizable variable defined in shell.el.gz.

Value

"^[^#$%>\n]*[#$%>] *"

Documentation

Regexp to match prompts in the inferior shell.

Defaults to "^[^#$%>\\n]*[#$%>] *", which works pretty well. This variable is used to initialize comint-prompt-regexp in the shell buffer.

If comint-use-prompt-regexp is nil, then this variable is only used to determine paragraph boundaries. See Info node (emacs)Shell Prompts for how Shell mode treats paragraphs.

The pattern should probably not match more than one line. If it does, Shell mode may become confused trying to distinguish prompt from input on lines which don't start with a prompt.

View in manual

Probably introduced at or before Emacs version 1.4.

Source Code

;; Defined in /usr/src/emacs/lisp/shell.el.gz
(defcustom shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
  "Regexp to match prompts in the inferior shell.
Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well.
This variable is used to initialize `comint-prompt-regexp' in the
shell buffer.

If `comint-use-prompt-regexp' is nil, then this variable is only used
to determine paragraph boundaries.  See Info node `Shell Prompts' for
how Shell mode treats paragraphs.

The pattern should probably not match more than one line.  If it does,
Shell mode may become confused trying to distinguish prompt from input
on lines which don't start with a prompt."
  :type 'regexp
  :group 'shell)