On Fri, Dec 09, 2011 at 04:12:15PM +0100, Jean-Jacques Brucker wrote: > I have solve my problem by making this small binary (i just needed a rewind) : > > int main(int argc,char * argv[]) { return lseek(atoi(argv[1]),0L,0); } > > But i ll be glad to use a standard and finished tool.
That looks pretty finished to me. ;-) > Of course we could make an "lseek" binary with some options to cover > all use cases of lseek function. But I prefer to have such > functionality inside bash. This probably belongs on help-bash rather than bug-bash, although it's a grey area. I'm Cc-ing both. If you want this functionality inside bash, one way to achieve that would be to write a loadable builtin, and enable it. Of course, then this would only work on the machine where you compiled and installed that builtin. Is this more desirable than an external "rewind" utility? Hard to say. In terms of creating a generalized lseek solution... I honestly can't think of a reason you would need this for shell scripts. There are several types of problems where rewinding to 0 might be desirable (mail delivery agents being the first to spring to mind), but seeking to arbitrary locations sounds a bit far-fetched. If you want to read randomly-accessed bytes from a file, you'd probably be better served writing your program in C in the first place.