[comp.unix.questions] Temporary stdin redirect

ubi@ginger.sri.com (Ron Ueberschaer x4399) (02/05/91)

There ought to be a way to start a program off with stdin redirected
from a file, then take over from real stdin.  Does such a capability
exist in UNIX, preferably under csh?  This would be analogous to the
>> append syntax, e.g.

	foo << start.input

would use start.input until EOF, then act normally, reading the terminal
for remaining input.

--Ron Ueberschaer
  ubi@unix.sri.com
  ...!{hplabs,rutgers}!sri-unix!ubi

subbarao@beam.Princeton.EDU (Kartik Subbarao) (02/05/91)

In article <20798@unix.SRI.COM> ubi@ginger.sri.com (Ron Ueberschaer x4399) writes:
>
>There ought to be a way to start a program off with stdin redirected
>from a file, then take over from real stdin.  Does such a capability
>exist in UNIX, preferably under csh?  This would be analogous to the
>>> append syntax, e.g.
>
>	foo << start.input
>
>would use start.input until EOF, then act normally, reading the terminal
>for remaining input.
>

You can use cat to do this:

cat start.input - | foo


			-Kartik

--
internet# find . -name core -exec cat {} \; |& tee /dev/tty*
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik@silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO@PUCC.BITNET			          - Bitnet

gwyn@smoke.brl.mil (Doug Gwyn) (02/05/91)

In article <20798@unix.SRI.COM> ubi@ginger.sri.com (Ron Ueberschaer x4399) writes:
>There ought to be a way to start a program off with stdin redirected
>from a file, then take over from real stdin.  Does such a capability
>exist in UNIX, preferably under csh?

The standard UNIX idiom for this is "cat file - | command".