Korn shell (for loop)
From Free media library
{{#switch: |Category = Pages in this category have | This page has }} been marked for eventual deletion.
{{#switch: |Category= They have
| It has}} been identified as reference material per the exclusion guidelines, which the community has decided to exclude from Wikisource (see "Inclusion of reference data on Wikisource"). These works will be phased out gradually; if you have found this page by following a link from another page, please go back and remove that link.{{#switch::Korn shell (for loop)
|Category:Deletion requests/Reference data = |Wikisource:Scriptorium = |
}}
Korn shell for loops consume lists.
#! /usr/bin/ksh # Author: Steve Callaway integer n=100 integer i for ((i=0; i < n; i++)) do echo $i done
Alternatively it is possible to run a reverse while loop as the following snippet demonstrates:
#! /usr/bin/ksh # Author: Steve Callaway typeset -i n=100 typeset -i ctr=0 while (( n )) do n=n-1 ctr=ctr+1 echo $ctr done