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

62 lines
1.8 KiB
HTML
Raw Permalink 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>getopts - Parse utility options</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>getopts - Parse utility options</h2>
<strong>Synopsis</strong>
<p><strong>getopts</strong> <em>optstring varname</em></p>
<p><strong>Description</strong></p>
<p>You can use <strong>getopts</strong> to check the positional
parameters for legal options. An option argument begins with a
minus (<strong>-</strong>). The end of the the options is marked by
the first argument that does not begin with a minus or an argument
of <strong>--</strong>.</p>
<p>Each time you call <strong>getopts</strong>, it places the next
option letter it finds in <em>varname</em>. <strong>qsh</strong>
stores the index of the next parameter to be processed in the
variable <strong>OPTIND</strong>. When an option requires an
argument, <strong>qsh</strong> stores the argument in the variable
<strong>OPTARG</strong>.</p>
<p><strong>Options</strong></p>
<p>None.</p>
<p><strong>Operands</strong></p>
<p>The option letters recognized by <strong>getopts</strong> are
identified in <em>optstring</em>. If a letter is followed by a
colon (<strong>:</strong>), that option is expected to have an
argument. The argument can be separated from the option letter by
&lt;space&gt;s.</p>
<p>With each call to <strong>getopts</strong>, <em>varname</em> is
updated with the option letter.</p>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 when successful.</li>
<li>&gt;0 when unsuccessful.</li>
</ul>
</body>
</html>