88 lines
2.3 KiB
HTML
88 lines
2.3 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=utf-8">
|
|
<title>read - Read a line from standard input</title>
|
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</HEAD>
|
|
<body bgcolor="#FFFFFF">
|
|
<!-- Java sync-link -->
|
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
|
|
|
|
|
|
|
<h2>read - Read a line from standard input</h2>
|
|
|
|
<strong>Synopsis</strong>
|
|
|
|
<p><strong>read</strong> [ <strong>-r</strong> ] [ <strong>
|
|
-p</strong> <em>prompt</em> ] [ <strong>-u</strong> [ <em>n</em> ]
|
|
] [ <em>name</em> ... ]</p>
|
|
|
|
<p><strong>Description</strong></p>
|
|
|
|
<p>You can use <strong>read</strong> to read a line and split it
|
|
into fields using the characters from the <strong>IFS</strong>
|
|
variable as delimiters. By default, a backslash
|
|
(<strong>\</strong>) at the end of a line causes the line to be
|
|
continued on the next line. <strong>qsh</strong> removes both the
|
|
backslash and the <newline>.</p>
|
|
|
|
<p><strong>Options</strong></p>
|
|
|
|
<dl>
|
|
<dt><strong>-p</strong> <em>prompt</em></dt>
|
|
|
|
<dd>When the interactive option is set, display <em>prompt</em> on
|
|
stderr.</dd>
|
|
|
|
<dt><strong>-r</strong></dt>
|
|
|
|
<dd>A backslash at the end of a line does not mean continue the
|
|
line.</dd>
|
|
|
|
<dt><strong>-u</strong> <em>n</em></dt>
|
|
|
|
<dd>Read from descriptor <em>n</em> if specified or descriptor 0 by
|
|
default. The descriptor must be 0 or one that you opened with
|
|
<strong>exec</strong>.</dd>
|
|
</dl>
|
|
|
|
<p><strong>Operands</strong></p>
|
|
|
|
<p>Each <em>name</em> is assigned to the corresponding field from
|
|
the input line. Any leftover fields are assigned to the last <em>
|
|
name</em>. The default name is the <strong>REPLY</strong>
|
|
variable.</p>
|
|
|
|
<p><strong>Exit Status</strong></p>
|
|
|
|
<ul>
|
|
<li>0 when successful.</li>
|
|
|
|
<li>>0 when unsuccessful.</li>
|
|
</ul>
|
|
|
|
<p><strong>Related information</strong></p>
|
|
|
|
<ul>
|
|
<li><a href="exec.htm">exec - Run commands and open, close, or copy
|
|
descriptors</a></li>
|
|
|
|
<li><a href="print.htm">print - Write output</a></li>
|
|
</ul>
|
|
|
|
<strong>Examples</strong>
|
|
|
|
<ol>
|
|
<li>Read a line from stdin after displaying a prompt: <strong>
|
|
read</strong> -p `Enter a name: ' firstname lastname</li>
|
|
|
|
<li>Read a line from descriptor 5: <strong>read</strong> -u5</li>
|
|
</ol>
|
|
</body>
|
|
</html>
|
|
|