octave: Customizing the Prompt

 
 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:
 
 ‘\t’
      The time.
 
 ‘\d’
      The date.
 
 ‘\n’
      Begins a new line by printing the equivalent of a carriage return
      followed by a line feed.
 
 ‘\s’
      The name of the program (usually just ‘octave’).
 
 ‘\w’
      The current working directory.
 
 ‘\W’
      The basename of the current working directory.
 
 ‘\u’
      The username of the current user.
 
 ‘\h’
      The hostname, up to the first ‘.’.
 
 ‘\H’
      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 ‘$’.
 
 ‘\nnn’
      The character whose character code in octal is NNN.
 
 ‘\\’
      A backslash.
 
  -- : VAL = PS1 ()
  -- : OLD_VAL = PS1 (NEW_VAL)
  -- : PS1 (NEW_VAL, "local")
      Query or set the primary prompt string.
 
      When executing interactively, Octave displays the primary prompt
      when it is ready to read a command.
 
      The default value of the primary prompt string is ’octave:\#> ’.
      To change it, use a command like
 
           PS1 ("\\u@\\H> ")
 
      which will result in the prompt ‘boris@kremvax> ’ for the user
      ‘boris’ logged in on the host ‘kremvax.kgb.su’.  Note that two
      backslashes are required to enter a backslash into a double-quoted
      character string.  SeeStrings.
 
      You can also use ANSI escape sequences if your terminal supports
      them.  This can be useful for coloring the prompt.  For example,
 
           PS1 ('\[\033[01;31m\]\s:\#> \[\033[0m\]')
 
      will give the default Octave prompt a red coloring.
 
      When called from inside a function with the "local" option, the
      variable is changed locally for the function and any subroutines it
      calls.  The original variable value is restored when exiting the
      function.
 
      See also: SeePS2 XREFPS2, SeePS4 XREFPS4.
 
  -- : VAL = PS2 ()
  -- : OLD_VAL = PS2 (NEW_VAL)
  -- : PS2 (NEW_VAL, "local")
      Query or set the secondary prompt string.
 
      The secondary prompt is printed when Octave is expecting additional
      input to complete a command.  For example, if you are typing a
      ‘for’ loop that spans several lines, Octave will print the
      secondary prompt at the beginning of each line after the first.
      The default value of the secondary prompt string is "> ".
 
      When called from inside a function with the "local" option, the
      variable is changed locally for the function and any subroutines it
      calls.  The original variable value is restored when exiting the
      function.
 
      See also: SeePS1 XREFPS1, SeePS4 XREFPS4.
 
  -- : VAL = PS4 ()
  -- : OLD_VAL = PS4 (NEW_VAL)
  -- : PS4 (NEW_VAL, "local")
      Query or set the character string used to prefix output produced
      when echoing commands is enabled.
 
      The default value is "+ ".  SeeDiary and Echo Commands, for a
      description of echoing commands.
 
      When called from inside a function with the "local" option, the
      variable is changed locally for the function and any subroutines it
      calls.  The original variable value is restored when exiting the
      function.
 
DONTPRINTYET       See also: Seeecho XREFecho, *noteecho_executing_commands:
DONTPRINTYET DONTPRINTYET       See also: Seeecho XREFecho, Seeecho_executing_commands

      XREFecho_executing_commands, SeePS1 XREFPS1, *notePS2:
DONTPRINTYET DONTPRINTYET       See also: Seeecho XREFecho, Seeecho_executing_commands

      XREFecho_executing_commands, SeePS1 XREFPS1, SeePS2

      XREFPS2.