471,073 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

how to use open with many input streams and capture output?

Hello,

There is an operation which can be performed at the shell prompt the
following way:

some_prg [some_inputfile_1] [some_inputfile_2] > result_file

However, before "some_prg" can use files, they have to be converted and it
can be done like this:

some_prg <(convert inputfile_1) <(convert inputfile_2) > result_file

It works perfectly at shell prompt.

I would like to start the above sequence in perl script using "open"
command:

open(SOME_OUTPUT,"some_prg <(convert inputfile_1) <(convert inputfile_2) |
");

When I try to run the script and capture SOME_OUTPUT, I get the following
error:

sh: -c: line 1: syntax error near unexpected token `('
sh: -c: line 1: `some_prg <(convert file_1) <(convert file_2)'

Is there any way to solve that syntax error without writing extra shell
scripts as I would like to have all the code in a single perl script?

Thank you for any help.

Pawel Banys

Jul 19 '05 #1
1 3711
Pawel Banys wrote:
some_prg <(convert inputfile_1) <(convert inputfile_2) > result_file

It works perfectly at shell prompt.


Which shell? That syntax is not valid for the /bin/sh (Bourne) shell,
which is what perl calls upon. For the Bourne shell, try this:

(convert inputfile_1; convert inputfile_2) | some_prog > result_file.

-Joe

P.S. Next time post to comp.lang.perl.misc, not comp.lang.perl .
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Gert Schumann | last post: by
13 posts views Thread by J. Campbell | last post: by
4 posts views Thread by jas | last post: by
8 posts views Thread by someone | last post: by
2 posts views Thread by gopala | last post: by
reply views Thread by starkman | last post: by
4 posts views Thread by George Oliver | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.