Re: about system()



Chas. Owens wrote:
On Thu, Jun 11, 2009 at 11:47, Tech W.<techwww@xxxxxxxxxxxx> wrote:
snip
system "command","-a","-b","-c";
snip

In this case Perl runs command directly

snip
system "command -a -b -c";
snip

In this case Perl runs the default shell for the OS and has it run command.

perldoc -f system
system LIST
system PROGRAM LIST
Does exactly the same thing as "exec LIST", except that a
fork is done first, and the parent process waits for the
child process to complete. Note that argument processing
varies depending on the number of arguments. If there is
more than one argument in LIST, or if LIST is an array with
more than one value, starts the program given by the first
element of the list with arguments given by the rest of the
list. If there is only one scalar argument, the argument is
checked for shell metacharacters, and if there are any, the
entire argument is passed to the system’s command shell for
parsing (this is "/bin/sh -c" on Unix platforms, but varies
on other platforms). If there are no shell metacharacters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in the argument, it is split into words and passed directly
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
to "execvp", which is more efficient.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov

.



Relevant Pages

  • Shell::Jobs - request for comments
    ... In an effort to make the code developed for the Zoidberg shellmore ... perl shells. ... # Run a shell command in the background ...
    (comp.lang.perl.modules)
  • Re: perl program with "&"
    ... This is an excellent suggestion. ... IW> it is a shell error message. ... This means that this isn't really a perl question. ... IW> I'd try typing your command into a shell command line before embedding ...
    (comp.lang.perl.misc)
  • Re: CLOSING Re: Obtaining complete Unix command line that evoked script as string
    ... > To: Grant Jacobs; beginners perl ... > perl and less, much less passing that information along to either ... Only shell that launched them is keeping track of the I/O ... > command is executed. ...
    (perl.beginners)
  • Re: Secure issues on the usage of exec
    ... I would not set a trap on SIGINT in a script? ... That's the same with any other command than sleep. ... :>: either but at least are much more usable as a shell). ... :>: have tcl, perl, python, ruby as programming languages. ...
    (comp.unix.shell)
  • Re: Why is first line always missing ?
    ... These are not described in man perl. ... The man command works fine in a pinch, ... The -n option creates a loop that iterates over every line* in the ...
    (perl.beginners)

Loading