Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: 'system @list' in background?

by ikegami (Pope)
on Jan 20, 2014 at 15:22 UTC ( #1071327=note: print w/ replies, xml ) Need Help??


in reply to 'system @list' in background?

system('cmd foo bar &')
is short for
system('/bin/sh', '-c', 'cmd foo bar &')

But you're surely asking to pass cmd, foo and bar as separate args.

We can use sh to build the command:

system('/bin/sh', '-c', '"$@" &', 'dummy', $prog, @args);

Or we can use a Perl module to build the command:

use String::ShellQuote qw( shell_quote ); system(shell_quote($prog, @args) . ' &'));


Comment on Re: 'system @list' in background?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1071327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-12-19 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (91 votes), past polls