Subject: Re: cat(1) question: multiple "-"s
To: Chavdar Ivanov <ci4ic4@gmail.com>
From: Johnny Billquist <bqt@update.uu.se>
List: netbsd-users
Date: 04/18/2006 19:24:33
Hmm, if that is correct, then it's actually meaningless to use several 
"-" arguments to cat in zsh as well.
zsh itself concatenates all the fiven stdin files, and give the whole 
bunch as one stdin stream, using the first "-" argument of cat. All the 
others will just give eof directly.

This should be easily verifyable.

Just try something like

cat - file - < file1 < file2

and check if file is located between file1 and file2.

	Johnny

Chavdar Ivanov wrote:
> On 18/04/06, Hubert Feyrer <hubert@feyrer.de> wrote:
> 
>>On Tue, 18 Apr 2006, Chavdar Ivanov wrote:
>>
>>>root@loan8>   cat - - - < /tmp/1 < /tmp/2 </tmp/3
>>>                                            /tmp
>>>11111
>>>22222
>>>33333
>>
>>Wow. How does that work?
>>
>>I'm familiar with the concepts of stdio, stdin and eof, but
>>how does cat/zsh know when to attach the next file to the stdin file
>>descriptor?
> 
> 
> From the zshmisc man page:
> ....
> If the user tries to open a file descriptor for reading more than once,
>        the  shell opens the file descriptor as a pipe to a process that copies
>        all the specified inputs to its output in the order specified,  similar
>        to cat, provided the MULTIOS option is set.  Thus
> 
>               sort <foo <fubar
> 
>        or even
> 
>               sort <f{oo,ubar}
> 
> .....
> 
> 
> 
>>
>>  - Hubert
>>

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol