1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
<html lang="en">
<head>
<title>Customizing the Prompt - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Command-Line-Editing.html#Command-Line-Editing" title="Command Line Editing">
<link rel="prev" href="Customizing-readline.html#Customizing-readline" title="Customizing readline">
<link rel="next" href="Diary-and-Echo-Commands.html#Diary-and-Echo-Commands" title="Diary and Echo Commands">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Customizing-the-Prompt"></a>
Next: <a rel="next" accesskey="n" href="Diary-and-Echo-Commands.html#Diary-and-Echo-Commands">Diary and Echo Commands</a>,
Previous: <a rel="previous" accesskey="p" href="Customizing-readline.html#Customizing-readline">Customizing readline</a>,
Up: <a rel="up" accesskey="u" href="Command-Line-Editing.html#Command-Line-Editing">Command Line Editing</a>
<hr>
</div>
<h4 class="subsection">2.4.7 Customizing the Prompt</h4>
<p><a name="index-prompt-customization-134"></a><a name="index-customizing-the-prompt-135"></a>
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:
<dl>
<dt>‘<samp><span class="samp">\t</span></samp>’<dd>The time.
<br><dt>‘<samp><span class="samp">\d</span></samp>’<dd>The date.
<br><dt>‘<samp><span class="samp">\n</span></samp>’<dd>Begins a new line by printing the equivalent of a carriage return
followed by a line feed.
<br><dt>‘<samp><span class="samp">\s</span></samp>’<dd>The name of the program (usually just ‘<samp><span class="samp">octave</span></samp>’).
<br><dt>‘<samp><span class="samp">\w</span></samp>’<dd>The current working directory.
<br><dt>‘<samp><span class="samp">\W</span></samp>’<dd>The basename of the current working directory.
<br><dt>‘<samp><span class="samp">\u</span></samp>’<dd>The username of the current user.
<br><dt>‘<samp><span class="samp">\h</span></samp>’<dd>The hostname, up to the first `.'.
<br><dt>‘<samp><span class="samp">\H</span></samp>’<dd>The hostname.
<br><dt>‘<samp><span class="samp">\#</span></samp>’<dd>The command number of this command, counting from when Octave starts.
<br><dt>‘<samp><span class="samp">\!</span></samp>’<dd>The history number of this command. This differs from ‘<samp><span class="samp">\#</span></samp>’ by the
number of commands in the history list when Octave starts.
<br><dt>‘<samp><span class="samp">\$</span></samp>’<dd>If the effective UID is 0, a ‘<samp><span class="samp">#</span></samp>’, otherwise a ‘<samp><span class="samp">$</span></samp>’.
<br><dt>‘<samp><span class="samp">\nnn</span></samp>’<dd>The character whose character code in octal is <var>nnn</var>.
<br><dt>‘<samp><span class="samp">\\</span></samp>’<dd>A backslash.
</dl>
<!-- input.cc -->
<p><a name="doc_002dPS1"></a>
<div class="defun">
— Built-in Function: <var>val</var> = <b>PS1</b> ()<var><a name="index-PS1-136"></a></var><br>
— Built-in Function: <var>old_val</var> = <b>PS1</b> (<var>new_val</var>)<var><a name="index-PS1-137"></a></var><br>
<blockquote><p>Query or set the primary prompt string. When executing interactively,
Octave displays the primary prompt when it is ready to read a command.
<p>The default value of the primary prompt string is <code>"\s:\#> "</code>.
To change it, use a command like
<pre class="example"> octave:13> PS1 ("\\u@\\H> ")
</pre>
<p class="noindent">which will result in the prompt ‘<samp><span class="samp">boris@kremvax> </span></samp>’ for the user
‘<samp><span class="samp">boris</span></samp>’ logged in on the host ‘<samp><span class="samp">kremvax.kgb.su</span></samp>’. Note that two
backslashes are required to enter a backslash into a double-quoted
character string.
See <a href="Strings.html#Strings">Strings</a>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dPS2.html#doc_002dPS2">PS2</a>, <a href="doc_002dPS4.html#doc_002dPS4">PS4</a>.
</p></blockquote></div>
<!-- input.cc -->
<p><a name="doc_002dPS2"></a>
<div class="defun">
— Built-in Function: <var>val</var> = <b>PS2</b> ()<var><a name="index-PS2-138"></a></var><br>
— Built-in Function: <var>old_val</var> = <b>PS2</b> (<var>new_val</var>)<var><a name="index-PS2-139"></a></var><br>
<blockquote><p>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 <code>for</code> 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 <code>"> "</code>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dPS1.html#doc_002dPS1">PS1</a>, <a href="doc_002dPS4.html#doc_002dPS4">PS4</a>.
</p></blockquote></div>
<!-- input.cc -->
<p><a name="doc_002dPS4"></a>
<div class="defun">
— Built-in Function: <var>val</var> = <b>PS4</b> ()<var><a name="index-PS4-140"></a></var><br>
— Built-in Function: <var>old_val</var> = <b>PS4</b> (<var>new_val</var>)<var><a name="index-PS4-141"></a></var><br>
<blockquote><p>Query or set the character string used to prefix output produced
when echoing commands is enabled.
The default value is <code>"+ "</code>.
See <a href="Diary-and-Echo-Commands.html#Diary-and-Echo-Commands">Diary and Echo Commands</a>, for a description of echoing commands.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002decho.html#doc_002decho">echo</a>, <a href="doc_002decho_005fexecuting_005fcommands.html#doc_002decho_005fexecuting_005fcommands">echo_executing_commands</a>, <a href="doc_002dPS1.html#doc_002dPS1">PS1</a>, <a href="doc_002dPS2.html#doc_002dPS2">PS2</a>.
</p></blockquote></div>
</body></html>
|