LOOP(1)

πŸ“¦
version 7.44.0 Β· 4 versions
, in nixpkgs unstable

πŸ’– 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 πŸ‘€

brlcad(1), rt(1), gencolor(1)


πŸ’Œ AUTHOR πŸ’Œ

BRL-CAD Team β€” legends, fr fr 🫢

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