LOOP(1)
π LOOP(1) β the BRL-CAD era π
okay bestie, listen β loop is that girl who just generates numbers for you, one per line, straight to standard output. She's literally built for driving counted loops in shell scripts, and she ate. π
β¨ SYNOPSIS β¨
loop [-c] start finish [incr]
π¦ DESCRIPTION π¦
So here's the vibe: loop prints out a sequence of values between start and finish, and yes β inclusive, she's not gonna leave finish hanging. One value per line, on standard output, periodt. She exists to drive counted loops in shell scripts, and honestly? She's iconic for it. π
The values are integers, real numbers, or characters. By default loop prints integers. But the second any of start, finish, or incr has a decimal point in it β or otherwise parses only as a floating-point number β she switches it up and generates and prints the whole sequence as real numbers (using %g formatting). Glow-up behavior, honestly. π
And then there's -c, which selects character sequences instead. Different era entirely. π§
The default incr is 1 when start is less than finish, and -1 when start is greater than finish β so the sequence always runs toward finish, never away from it. She knows where she's going. π«Ά
β οΈ okay important: an incr of zero is an error. And no cap β loop makes no attempt to detect or prevent infinite loops. So if you set that up, that's on you, bestie. ππ
For integer sequences, loop preserves zero padding: if start, finish, or incr is written with leading zeros, the output gets left-padded with zeros to the width of the widest such argument β like, for example, 008 through 010. She keeps the formatting cute. π
πΈ OPTIONS πΈ
-cβ generate a character sequence. start and finish are taken as single characters, and the output steps through the character codes between them. You can throw in an optional incr, but it must be an integer. no exceptions, iykyk π
π₯ EXAMPLES π₯
Example 1 β counting from 10 to 30 in steps of 5 β
loop 10 30 5
Prints 10, 15, 20, 25, 30 on successive lines. Stepping in fives, living her life. π
Example 2 β driving a render loop over zero-padded frame numbers π¬
for frame in $(loop 001 100) ; do
rt -o frame${frame}.pix -F /dev/null model.g component
done
Renders 100 frames, naming the outputs frame001.pix through frame100.pix. And the reason this slays? Because the bounds are written with leading zeros, loop zero-pads every value to three digits, so the file names sort correctly. main character file-name energy. π
Example 3 β a descending real-number ramp π
loop 1.6 0.1 -0.5
Prints 1.6, 1.1, 0.6, 0.1. The decimal point is what selects floating-point mode, and the negative incr steps her downward. down bad, on purpose. π
Example 4 β stepping through an alphabetical range π¦
loop -c a e
Prints the characters a through e, one per line. simple, clean, adorable. π
π SEE ALSO π
π AUTHOR π
BRL-CAD Team β legends, fr fr π«Ά
Β©οΈ COPYRIGHT Β©οΈ
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. don't be shy, they're nice π
and that's the whole page, bestie β stay hydrated, read your man pages, and remember: this was brought to you by BRL-CAD, page LOOP(1), from the bottom of the page to the top πβ¨
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms