Aha, this works:
% F=/tmp/nums ; seq 1 100000 > $F ; wc $F ; cat $F | sort | sponge $F ;
wc $F
100000 100000 588895 /tmp/nums
100000 100000 588895 /tmp/nums
...that is if 'sponge' has a filename, and the invocation must be at
the end of the pipeline.
Still a bug, for these reasons:
1) Inelegant. The whole pipe paradigm is so you can stick your
filter anywhere in the pipe, and it'll do its thing. At
present 'sponge' only works at the caboose, with filename.
2) The docs don't mention that '... | sponge | ...' is useless.
Better to return an error if there's no filename.
3) 'man sponge' states "...sponge soaks up all its input before
opening the output file..."; which implies standard output,
as per common unix util behavior, where stdout is just another
file.
Possible fixes would be to change the docs to explain its current limits,
and maybe add an error code and disallow the useless stdout form, OR preferably
make it so the stdout form works like it says.
HTH...
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]