Next: , Previous: Customizing readline, Up: Command Line Editing

2.4.7 Customizing the Prompt

The following variables are available for customizing the appearance of the command-line prompts. Octave allows the prompt to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:

The time.
The date.
Begins a new line by printing the equivalent of a carriage return followed by a line feed.
The name of the program (usually just `octave').
The current working directory.
The basename of the current working directory.
The username of the current user.
The hostname, up to the first `.'.
The hostname.
The command number of this command, counting from when Octave starts.
The history number of this command. This differs from `\#' by the number of commands in the history list when Octave starts.
If the effective UID is 0, a `#', otherwise a `$'.
The character whose character code in octal is nnn.
A backslash.

— Built-in Variable: PS1

The primary prompt string. When executing interactively, Octave displays the primary prompt PS1 when it is ready to read a command.

The default value of PS1 is "\s:\#> ". To change it, use a command like

          octave:13> PS1 = "\\u@\\H> "

which will result in the prompt `boris@kremvax> ' for the user `boris' logged in on the host `'. Note that two backslashes are required to enter a backslash into a string. See Strings.

— Built-in Variable: PS2

The secondary prompt string, which is printed when Octave is expecting additional input to complete a command. For example, when defining a function over several lines, Octave will print the value of PS1 at the beginning of each line after the first. The default value of PS2 is "> ".

— Built-in Variable: PS4

If Octave is invoked with the --echo-commands option, the value of PS4 is printed before each line of input that is echoed. The default value of PS4 is "+ ". See Invoking Octave, for a description of --echo-commands.