SEQ(1plan9)

πŸ’– SEQ(1plan9) πŸ’–

okay bestie, welcome to section 1 of the Plan 9 manual, where we talk about seq β€” the little command that goes brrr and prints you a whole list of numbers. she's simple, she's iconic, she's giving calculator-but-make-it-fancy. ✨


πŸŽ€ NAME πŸŽ€

seq β€” print sequences of numbers πŸ’…


🌸 SYNOPSIS 🌸

seq [ -w ] [ -fformat ] [ first [ incr ] ] last

πŸ¦‹ DESCRIPTION πŸ¦‹

seq prints a sequence of numbers, one per line, starting from first (and if you don't give her a first, she defaults to 1) and going up to as near last as possible, stepping by incr (default 1 if you don't say otherwise). no cap, that's the whole vibe.

the loop is literally this, bestie:

for(val = min; val <= max; val += incr) print val;

the numbers are interpreted as floating point. yes, floats. she contains multitudes. 🌈

normally, integer values get printed as plain decimal integers. and then there are the options:


✨ OPTIONS ✨

  • -fformat β€” use the print(3)-style format print for printing each (floating point) number. the default is
not me noticing the manpage literally says "The default is" and then just… stops πŸ’€ the page leaves it hanging, so i'm leaving it hanging too. no invented facts on my watch.
  • -w β€” equalize the widths of all the numbers by padding with leading zeros as necessary. heads up though: it's not effective with option -f, and it's also not effective with numbers in exponential notation. so pick your fighter. πŸ₯Š

πŸ‘‘ EXAMPLES πŸ‘‘

  1. seq 0 .05 .1 β€” print 0 0.05 0.1 (each on its own separate line). clean, minimal, ate. πŸ“
  2. seq -w 0 .05 .1 β€” print 0.00 0.05 0.10. same numbers, now with matching widths, because symmetry is self care. πŸŽ€

🌈 SOURCE 🌈

/src/cmd/seq.c

go read the source if you want the tea straight from the kettle πŸ«–


πŸ’€ BUGS πŸ’€

option -w always surveys every value in advance. so seq -w 1000000000 is a genuinely painful way to try and get an 'infinite' sequence. like, it will absolutely make you wait. do not do this to your terminal, she doesn't deserve it. 😭

and that's the whole page, bestie!! this was section 1 of the Plan 9 manual, and the footer was just SEQ(1plan9) β€” no extra version string, no date, just the name looking cute. slay, mwah, go print some numbers πŸ’–βœ¨πŸ§š

πŸ“¦ where this page comes from