tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposed modification to seq



Greg Troxel wrote:

> aran%100acres.us@localhost writes:
>
> > The seq command behaves a little differently than I expect.  I needed a comma
> > separated list of integers, but seq gave me this:
> >
> >  $seq -s , 1 3
> >  1,2,3,$
> >
> > Notice the extra comma and no trailing return.  The comma is troublesome for my
>
>  [ ... ]
>
> It could just be a bug.  But the man page is inconsistent.
>
> I suspect there is almost no use of -s.  But I wonder.
>
> If this change makes seq with -s behave like GNU seq, and more closely
> aligns with seq's own man page, that seems like a reasonable thing.

GNU coreutils seq does this:

	otos:~ 2057> seq -s , 1 3
	1,2,3

Looking at their seq.c:

	/* The string used to separate two numbers.  */
	static char const *separator;

	/* The string output after all numbers have been output.
	   Usually "\n" or "\0".  */
	static char const terminator[] = "\n";

with no option to change the terminator option.

I agree that Aran's suggested change looks a good idea.

Cheers,
Simon.


Home | Main Index | Thread Index | Old Index