[Tutor] execute an OS command, get the output

Alan Gauld alan.gauld at freenet.co.uk
Sun Mar 12 09:37:19 CET 2006


> I gotta admit, this took me by surprise, too, but my guess is that once
> the head command is done, it closes the pipe it's reading from, which is
> being filled by grep; grep takes the hint and terminates, closing the pipe
> it's reading from, which is being filled by strings; and strings takes the
> hint and terminates, even though it hasn't gotten through the entire file.

yeah, that kind of makes sense. I forgot you were using head not tail - I
normally use tail for that kind of thing - in fact I think I've only used 
head
about 2 or 3 times in my life! But head could well stop as soon as it gets
the first 10 lines from grep.

Interesting, I must try some experiments....

Alan G




More information about the Tutor mailing list