How to use 2 forms of standard input.

How to use 2 forms of standard input.

Post by Matthew Land » Fri, 03 Dec 1999 04:00:00



I would like to have 2 sources of stdin for a script.  I would like both
keyboard input OR FIFO input to control the same stdin pipe.  For stdout,
one can use tee to connect stdout to 2 locations.  Is there a method like
this for stdin?

 - Matt

--

  AIX and HACMP Certified Specialist   | |  / \ |\| |  \. ,_|  ` o O '
  / Comments, views, and opinions \    | |_/ ^ \|   | ) | |       x    
  \ are mine alone, not IBM's.    /    |___|/~\_\_|\|__/|_|     \___/

 
 
 

How to use 2 forms of standard input.

Post by Kurt J. Lanz » Fri, 03 Dec 1999 04:00:00



> I would like to have 2 sources of stdin for a script.  I would like both
> keyboard input OR FIFO input to control the same stdin pipe.  For stdout,
> one can use tee to connect stdout to 2 locations.  Is there a method like
> this for stdin?

Hmm... 'tee' is a separate process which duplicates
standard output to another file. I suppose you could
write a C program to listen on both stdin and a FIFO,
but then you must answer the question of how you merge
the 2 streams -- line by line? Character by character?
Which ever comes first (and how do you determine that)?

 
 
 

How to use 2 forms of standard input.

Post by Ken Pizzi » Fri, 03 Dec 1999 04:00:00



>I would like to have 2 sources of stdin for a script.  I would like both
>keyboard input OR FIFO input to control the same stdin pipe.  For stdout,
>one can use tee to connect stdout to 2 locations.  Is there a method like
>this for stdin?

(cat FIFO & cat; wait) | script

                --Ken Pizzini

 
 
 

How to use 2 forms of standard input.

Post by Matthew Land » Fri, 03 Dec 1999 04:00:00




> >I would like to have 2 sources of stdin for a script.  I would like both
> >keyboard input OR FIFO input to control the same stdin pipe.  For stdout,
> >one can use tee to connect stdout to 2 locations.  Is there a method like
> >this for stdin?

> (cat FIFO & cat; wait) | script

>                 --Ken Pizzini

Excellent!  Thank you very much.  However, for my situation one little
change needed to be made to keep the FIFO pipe open to the input, else
it would only pass the first chunk sent to the FIFO... tail -f FIFO
instead of cat FIFO.  Once that change was made I had consistent control
over both inputs... Keyboard, AND echo "<command>" >> FIFO.

 - Matt

--

  AIX and HACMP Certified Specialist   | |  / \ |\| |  \. ,_|  ` o O '
  / Comments, views, and opinions \    | |_/ ^ \|   | ) | |       x    
  \ are mine alone, not IBM's.    /    |___|/~\_\_|\|__/|_|     \___/

 
 
 

How to use 2 forms of standard input.

Post by Ken Pizzi » Sat, 04 Dec 1999 04:00:00



>> (cat FIFO & cat; wait) | script
>Excellent!  Thank you very much.  However, for my situation one little
>change needed to be made to keep the FIFO pipe open to the input, else
>it would only pass the first chunk sent to the FIFO... tail -f FIFO
>instead of cat FIFO.

Since it is a FIFO file, and you don't want EOF to end the
reading of it, a cheaper way than using "tail -f" is:
   (cat FIFO 3<FIFO & exec cat) | script

                --Ken Pizzini

 
 
 

How to use 2 forms of standard input.

Post by Ken Pizzi » Sat, 04 Dec 1999 04:00:00



Quote:>Since it is a FIFO file, and you don't want EOF to end the
>reading of it, a cheaper way than using "tail -f" is:
>   (cat FIFO 3<FIFO & exec cat) | script

Bah!  That should read:
    (cat FIFO 3>FIFO & exec cat) | script

                --Ken Pizzini

 
 
 

1. Using form inputs, how do I upload a file ?

Hi,

I am creating a webpage where the user would input to a form
something like :

http://foo.com/~bar/foobar.html

I would like to upload this file (foobar.html) to my machine i.e. the
server from which
I am running the web page.

Is it possible to do this?  If yes, I would greatly appreciate any
pointers that would help
me accomplish this.

Thanks in advance for your time.


2. An idiot newbie question, regarding gcc.

3. standard input instead of input file

4. Date format autochanged?

5. using arrow keys in standard input

6. (FAQ?) How to get *right* libXt.a? or use .so

7. Trouble using rlogin with a file redirected to standard input

8. One print job creates thousands

9. LCSDNYR 2001 -> standards, standards, standards

10. URGENT: W3C form standards for non-wintel platforms

11. Subverting Apache's standard behavior- Can I keep the names of empty form fields?

12. Alliance Formed Around Sun's Java API Standard

13. Supressing Form feed for a standard printer config