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

47 lines
1.1 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>For 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>For command</h2>
<p>The syntax of the <strong>for</strong> command is</p>
<p><strong>for</strong> <em>variable</em> <strong>in</strong> <em>
word</em> ...</p>
<p><strong>do</strong> <em>list</em></p>
<p><strong>done</strong></p>
<p>The <em>words</em> are expanded, and then <em>list</em> is run
repeatedly with <em>variable</em> set to each <em>word</em> in
turn. You can replace <strong>do</strong> and <strong>done</strong>
with braces (<strong>{</strong> <strong>}</strong>).</p>
<p><strong>Examples</strong></p>
<ol>
<li>A for command to process a list of objects.
<pre>
list=$(ls *.class)
for object in $list
do
system "DSPJVAPGM $object"
done
</pre>
</li>
</ol>
</body>
</html>