0
exec 'foo.sh > foo.out'

causes problems, due to the command being called through a shell rather than directly exec'd. How can I set up the redirection to foo.out first and then just exec 'foo.sh'?

4

1 回答 1

1
open(STDOUT, '>', 'foo.out') or die $!;
exec 'foo.sh', @args;

并保证在@args为空的情况下“直接执行”,

exec { 'foo.sh' } 'foo.sh', @args;
于 2013-10-24T03:37:34.237 回答