GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
LOOP(1) BRL-CAD LOOP(1)

loop - generate numerical indices for shell loops, etc.

loop [-c] start finish [increment]

loop generates a sequence of numbers between start and finish inclusive, one per line, on stdout. This is mostly useful for driving loops when writing Shell programs sh(1). The default increment is +1 when start<finish, and -1 when start>finish. An optional increment may be specified. If increment is zero, then the start value will be generated continuously.

Both floating point and integer arguments can be used. On integer arguments, if leading zeros are specified, they will be preserved on output. This is useful for generating sequences of file names which are numbered with leading zeros.

-c is used for character (char) looping.

for i in `loop 10 30 5`
do
  echo $i
done

will display the values 10, 15, 20, 25, 30 .

for i in `loop 008 005`
do
  echo $i
done

will display the values 008, 007, 006, 005 .

for i in `loop 0.1 2.9 0.5`
do
  echo $i
done

will display the values 0.1, 0.6, 1.1, 1.6, 2.1, 2.6 .

This program just scratches the surface. The shells could benefit from a greater ability to perform math. Limitless opportunities for extensions exist, but this simple version is adequate for most shell scripts dealing with sequences of images, etc.

BRL-CAD Team

This software is Copyright (c) 1986-2019 by the United States Government as represented by U.S. Army Research Laboratory.

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org
06/07/2022 BRL-CAD

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.