Linux Administration
medium

Pregunta de Linux Administration #019e3987

Enunciado de la Pregunta
Linux Administration
#seq
#number-sequence
#increment
#default-start
Medio

What output will the command seq 10 produce?

A

A continuous stream of numbers increasing in increments of 10 until stopped.

B

The numbers 1 through 10 with one number per line.

Correcto
C

The numbers 0 through 9 with one number per line.

D

The number 10 to standard output.

Explicación Oficial / Explicaciones de la Comunidad

The seq command in Linux generates a sequence of numbers. By default, without any flags, seq starts at 1, increments by 1, and ends at the specified last number. The output is one number per line.

How it Works

  • seq 10 is equivalent to seq 1 1 10 (start=1, increment=1, end=10).
  • It prints numbers from 1 to 10 inclusive, each on a separate line.
  • The command does not produce a continuous stream; it outputs all numbers and then exits.

Why the Correct Answer is Right

The output of seq 10 is exactly the numbers 1 through 10, one per line. This is the default behavior of seq.

Why the Incorrect Answers are Wrong

  • A continuous stream of numbers increasing in increments of 10 until stopped: This describes an infinite loop or a command like yes or watch, not seq. seq always terminates after printing the specified sequence.
  • The numbers 0 through 9 with one number per line: This would be the output of seq 0 9 or seq 9 if counting from 0, but seq defaults to starting at 1, not 0.
  • The number 10 to standard output: This would be the output of echo 10 or seq 10 10, but seq 10 prints all numbers from 1 to 10, not just the last one.

After issuing: