[mdlug] Forgotten command

Michael Corral micorral at comcast.net
Wed Jan 10 10:12:23 EST 2007


Wojtak, Greg a ecrit:
> OK, I¹m drawing a blank here... what is the command in Linux to generate a
> list of numbers.  I thought it was called step.  If you did `step 1 5', it
> would spit out 1 2 3 4 5.  Useful in for loops so you didn't have to type
> out each number.

It's seq, but if you're just using it to generate a sequential list
of numbers in a for loop, then you don't need seq. Bash (and ksh)
can use the built-in ((...)) construct to do this:

for ((i=1; i<=10; i++)) {
    echo "$i"
}

The (small) advantage of this is you don't have to make a call to an
external program like seq.

Michael


More information about the mdlug mailing list