[comp.unix.questions] Duplicate stdin to stdout

P.F.Hendricks@PacBell.COM (P.F.Hendricks) (12/08/90)

I have a program that builds a script file to feed input into a program.
My problem is that there is a possiblity of errors occuring during input
however there is no easy way to know where the error occured.

To make things a little clearer here is an example of what I mean.

----------------------------------------
/usr/local/bin/buildlist << EOF
555-1234
John
Doe
1234 Main St.
  .
  .
 (100 to 200 more entries follow)
  .
555-5678
Jane
Zule
2314 Juniper Dr.
EOF
----------------------------------------

There may be an entry already for 'John Doe' but all I get from the
program 'buildlist' is "? DUPLICATE ENTRY", no name, no number, nothing.

What I would like to do is be able to duplicate the input from the script
to the standard ouput, or a file. I've RTFM'd but and my impression is that
it can't be done, but I've been wrong before. So I'm hoping the net wisdom
can enlighten me, in fact I'm counting on it...

BTW - I'm running SYSV 3.1 on a 3B20.

Thank you.

-Paul

engbert@cs.vu.nl (Engbert Gerrit IJff) (12/11/90)

In article <2431@pbhyg.PacBell.COM>,
	P.F.Hendricks@PacBell.COM (P.F.Hendricks) writes:
) 
) I have a program that builds a script file to feed input into a program.
) My problem is that there is a possiblity of errors occuring during input
) however there is no easy way to know where the error occured.
) 
) To make things a little clearer here is an example of what I mean.
) 
) ----------------------------------------
) /usr/local/bin/buildlist << EOF
) 555-1234
) John
) Doe
) 1234 Main St.
)   .
)   .
)  (100 to 200 more entries follow)
)   .
) 555-5678
) Jane
) Zule
) 2314 Juniper Dr.
) EOF
) ----------------------------------------
) 
) There may be an entry already for 'John Doe' but all I get from the
) program 'buildlist' is "? DUPLICATE ENTRY", no name, no number, nothing.
) 
) What I would like to do is be able to duplicate the input from the script
) to the standard ouput, or a file. I've RTFM'd but and my impression is that
) it can't be done, but I've been wrong before. So I'm hoping the net wisdom
) can enlighten me, in fact I'm counting on it...
) 
) BTW - I'm running SYSV 3.1 on a 3B20.
) 
) Thank you.
) 
) -Paul
Right out of the head:
try
cat << EOF | tee | /usr/local/bin/buildlist
555-1234
	.

	.

	.

EOF

tee duplicates stdin to stdout and stderr
stdout can be redirected to a file or a pipe

however, if you want to use it to catch the duplicate
entry I fear it will not help you, because of the blocked
I/O

I have no time to RTFM right now, but maybe
there is a flag on the shell you use that will
show you the lines as they are passed to buildlist.

Hope this helps,
Bert

jimr@hp-lsd.COS.HP.COM (Jim Rogers) (12/11/90)

/ hp-lsd:comp.unix.questions / P.F.Hendricks@PacBell.COM (P.F.Hendricks) /  4:14 pm  Dec  7, 1990 /

{
cat << EOF
555-1234
John
Doe
1234 Main St.
  .
  .
 (100 to 200 more entries follow)
  .
555-5678
Jane
Zule
2314 Juniper Dr.
EOF
} | tee /dev/tty | /usr/local/bin/buildlist 



Jim Rogers
Hewlett Packard Company