[lug] Fwd: Simple counter?
Anthony Foiani
tkil at scrye.com
Fri May 24 19:03:38 MDT 2013
"Jeffrey S. Haemer" <jeffrey.haemer at gmail.com> writes:
> I want something that returns me sequential integers. Â I ask it, I get
> a 1. Â Three more times? Â I get 2,3,4. Â You ask it, you get 5, I ask
> again, I get 6, and so on. Â If we both call it at the same time, we
> should *not* get the same number.
>
> Must persist over re-boots.
>
> Sort of like /dev/urandom, but less random. :-)
cf http://dilbert.com/strips/comic/2001-10-25/
> We could all write simple programs to do this in lots of different
> ways, but doesn't it seem like there should already be some utility
> already out there that fits the bill?
Hm. It was surprisingly non-simple, but I suspect that unix
greybeards could find lots of room for improvement:
http://scrye.com/~tkil/blug/counter.c
> Honest: this isn't "How can I write a simple program to do this?"
> Â It's, "Hasn't someone created a simple, standard utility that does
> this in the past 20 or 30 years?"
I wonder if 'seq' has a persistent mode somewhere...
t.
More information about the LUG
mailing list