These docs are under active development and cover the v0.20 Kobicha security model.
On this page
reference 1 min read

seq

seq prints a sequence of numbers, one per line.

seq [options] last
seq [options] first last
seq [options] first increment last
$ seq 3
1
2
3
$ seq 2 2 10
2
4
6
8
10

The three forms control where the sequence starts and how it steps:

  • seq last — count from 1 up to last.
  • seq first last — count from first up to last.
  • seq first increment last — count from first to last, stepping by increment.

The increment may be negative, to count down, and the numbers may be fractional. seq is most often used to drive a loop a fixed number of times.

Options

Option Effect
-s, --separator=STRING Separate the numbers with STRING instead of a newline.
-t, --terminator=STRING End the output with STRING instead of a newline.
-w, --equal-width Pad the numbers with leading zeros so they all have the same width.
-f, --format=FORMAT Format each number with a printf-style floating-point FORMAT.
$ seq -s , 1 5
1,2,3,4,5
$ seq -w 8 10
08
09
10

-f takes a single floating-point conversion — see printf for the format syntax — and cannot be combined with -w.

Exit status

Code Meaning
0 The sequence was printed.
1 An argument was not a valid number, the increment was zero, or no argument was given.