ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/selectcmd.htm

61 lines
1.8 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!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>Select command</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>Select command</h2>
<p>The syntax of the <strong>select</strong> command is</p>
<p><strong>select</strong> <em>name</em> <strong>[ in</strong> <em>
word</em> ... <strong>]</strong></p>
<p><strong>do</strong> <em>list</em></p>
<p><strong>done</strong></p>
<p>The <em>words</em> are expanded, generating a list of items.
If <em>word</em> is not specified, the positional parameters are
expanded. The set of expanded words is written to standard
error, each preceded by a number. The PS3 prompt is then displayed
and a line is read from standard input. If the line consists of a
number corresponding to one of the displayed words, <strong>qsh</strong>
sets the value of <em>name</em> to the word corresponding to
the number. If the line is empty, <strong>qsh</strong> displays the
list again. The REPLY variable is set to the contents of the input
line.</p>
<p><strong>qsh</strong> runs the commands in <em>list</em> until a
<a href="break.htm">break</a>, <a href="return.htm">return</a>, or
<a href="exit.htm">exit</a> command is run. <strong>select</strong>
also completes if EOF is read from standard input.
</p>
<p><strong>Examples</strong></p>
<ol>
<li>A select command to select from a list.
<pre>
PS3="Please select a number "
list="alpha beta gamma delta epsilon"
select value in $list ; do
echo Value for selection $REPLY is $value
break
done
</pre>
</li>
</ol>
</body>
</html>