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

47 lines
1.0 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>While 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>While command</h2>
<p>The syntax of the <strong>while</strong> command is</p>
<p><strong>while</strong> <em>list1</em></p>
<p><strong>do</strong> <em>list2</em></p>
<p><strong>done</strong></p>
<p><strong>qsh</strong> runs the two lists repeatedly while the
exit status of <em>list1</em> is zero. When the exit status of <em>
list1</em> is non-zero the command completes.</p>
<p><strong>Examples</strong></p>
<ol>
<li>A while command to iterate until a condition is met.
<pre>
max=100
index=0
while [[ $index -lt $max ]] ; do
echo Index is $index
let index+=1
done
</pre>
</li>
</ol>
</body>
</html>