Vortacist has asked for the wisdom of the Perl Monks concerning the following question:
This failed on close, and I learned from reading perlman:perlipc that if a command can't accept input from a pipe, it will always die on close.open(COPY, "| cp") || die("Could not open COPY: $!");; print COPY "file1 file2" || die("Could not print to COPY: $!"); close COPY || die("Could not close COPY: $!");
My question is: is there any way to tell ahead of time whether or not the command I want to pipe to will accept my input, a more efficient test than just seeing if it dies on close? Is there a list compiled somewhere of standard Unix commands that will/won't take input from a pipe?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Piping into system commands
by Fastolfe (Vicar) on Jan 24, 2001 at 07:32 UTC | |
|
Re: Piping into system commands
by lemming (Priest) on Jan 24, 2001 at 07:24 UTC | |
|
Re: Piping into system commands
by chipmunk (Parson) on Jan 24, 2001 at 07:39 UTC | |
|
(tye)Re: Piping into system commands
by tye (Sage) on Jan 24, 2001 at 07:20 UTC |