Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
An important thing to realize is that >tape is not an argument to the program, it's an instruction to the shell. The shell will open up the file tape, and redirect the output of cpio to that file. The command will never see that file on its command line at all.

Many commands that start programs, like system, exec, and IPC::Run::start, if given a list will directly execute the given program with the given arguments, without using the shell at all. Since it's the shell's job to handle output redirection, with no shell it doesn't happen.

It looks like you have one workable solution in your responses already, which is to use IPC::Run's speicial syntax for output redirection, something like IPC::Run::run \@cmd, '>', $tape. The docs say you can also pass a single string to IPC::Run::run, which will be passed to the shell, so IPC::Run::run("/bin/cpio -ov >$tape") might also work. Finally, for something so simple, consider just system.

Hope this helps!


In reply to Re: Using IPC::Run by sgifford
in thread Using IPC::Run by gw1500se

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found