tech-userlevel archive

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

Re: jot: producing too much output?



>> jot -s "" - 32 126

>> Based on reading the manpage, I would expect that to produce a
>> single line 323334353637...124125126.  It does on my 1.4T.  On my
>> 5.2, ftp.n.o's 9.0_STABLE, and a work 9.1 machine, the line actually
>> ends ...125126127128129130131.

> The man page actually says:

>      If fewer than three [of the reps begin end & step args] are specified,
>      defaults are assigned left to right, except for s, which assumes its
>      default unless both begin and end are given.

Right.  So I would expect "- 32 126" to behave like "100 32 126 1".
And text which you didn't quote says "If four [args] are specified and
the given and computed values of reps conflict, the lower value is
used".  That is not directly applicable because only two values were
specified, but it does seem reasonable to me to expect the reps value
computed from the given begin and end and the defaulted step - meaning
95 in this case - to be used.  Forcing users to compute the number of
values they want when specifying both begin and end strikes me as
counterintuitive at best.

In any case, it's of mostly academic interest to me personally; I
normally use count(1), a program of my own that defaults in ways that
make more sense to me.  I just had occasion to want to generate
sequential data on a machine that didn't have my suite of utilities set
up, leading me to go looking.  When jot didn't give I wanted, I wrote
shell loop (i=BEGIN; while [ $i -lt END ]; do BODY; i=$(($i + 1)); done
or something like it).

But it did look to me as though jot wasn't behaving the way I thought
the manpage said it should, hence my mail.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index