I knew `seq` was available on BSDs. For some reason I thought it was on SVr4-derived Unices too (and therefore figured it was either actually Posix, or ubiquitous enough to be reliable anyway), but I guess I got that one wrong.
Maybe because GNU tends to be a bit more heavily influenced by SVr4 than BSD, historically?
If you're ok with integer math and no switches, you can easily make your own seq.
The next time that you are on an OSF/1 operating system, you can use this portable version. It's also probably faster than the fork() overhead, assuming dash.
seq () {
if [ -n "$3" ]
then FIRST=$(($1 + 0)) INCREMENT=$(($2 + 0)) LAST=$(($3 + 0))
else if [ -n "$2" ]
then FIRST=$(($1 + 0)) INCREMENT=1 LAST=$(($2 + 0))
else FIRST=1 INCREMENT=1 LAST=$(($1 + 0))
fi
fi
c=$FIRST
until [ $c -gt $LAST ]
do printf %d\\n $c
c=$((c + INCREMENT))
done
}
The point I was making is that because (to my recollection) GNU tends to mimic SVr4, the fact that `seq` is in GNU is probably why I thought it was also available in SVr4-derived Unices.
But also, I know that `seq` is in the BSDs.
Therefore, if `seq` were in GNU, SVr4 and the BSDs, then a) the chances that it would have been included in Posix are very high, and b) even if it wasn't in Posix, the fact that it's in all 3 of those families of shell tools would make it ubiquitous enough that I'd be happy to rely on it for a personal project that I intended to be widely portable anyway.
(Posix tends to codify existing common practice, rather than designing new features for existing systems to implement.)