Hi Tobias,

Based on what you scrieb:

> mkfifo xyz
> tee my.log <xyz &
> ls -la >xyz 2>&1
> rm xyz

> mkfifo creates a 'named pipe'
> tee is running in the background as long as the xyz exists
> ls writes stdin + stderr to the pipefile,

and my failing OP attempt,

ls -R .../linux-3.3.6 | tee >(grep -m 5 devices > temp.txt)

could you please put together a command _your way_ (for me to try) that
_completely_ and _successfully_ does what I had wanted to achieve:

1. To see the 'ls' output scroll on the console all the way to the bitter end
(as if it was all alone without the pipe:

  ls -R linux-3.3.6
)
no matter when 'grep' decided to exit

and

2. At the end of the full 'ls' listing to find in the 'temp.txt' file
 just five lines corresponding to the first five lines in the 'ls' output
 containing the word "devices".

NOTES
1. Instead of 'linux-3.3.6' (and -R), you can _obviously_ use any directory
with plenty of files to generate, say, 10 seconds worth of display.

2. The "devices" word can be _obviously_ any word of _your_ preference,
as long it is guaranteed to appear in the 'ls' output on at least five lines.

For example,

 Donaudampfschifffahrtsgesellschaftskapitän

will do
(if it happens to occur on at least five lines in the 'ls' output).

3.  The "5" in 'grep -m 5' can be as low as "1".
Not too large, though, so as not to wipe out a typical Linux user
drive size of 500KB in the process.
(while at it, assume a CPU at least the power of 386SX)

Hochachtungsvoll,
-- Alex

PS   I remember reading somewhere that a construct like
>( grep ...)
creates a so-called 'named pipe'.
Go figure.
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to