The seq command prints a sequence (range) of numbers, based on some incrementing value.
$ seq 0 1 10
- prints a range (sequence) of numbers from 0 to 10, incrementing by 1
$ seq 1 2 18
- prints a range (sequence) of numbers from 1 to 18, incrementing by 2
$ seq 2 3 30
- prints a range (sequence) of numbers from 2 to 30, incrementing by 3
Is there another "single" command that can perform the same task?
Thanks in advance!
Hi
An alternative to the seq command would be the printf command. As follows:
printf "%s\n" {0..10}
printf "%s\n" {1..18..2}
printf "%s\n" {2..30..3}
This will produce the same results as the seq commands.
The difference here is that you have to specify both the format of the output and the incremental vaue is last in the list of parameters!
Regards
AA
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.