[ILUG] Perl Question.

Niall O Broin niall at linux.ie
Wed Jun 8 14:08:05 IST 2005


On 8 Jun 2005, at 13:22, Kevin O'Riordan wrote:

>>> As Niall pointed out, you could probably join the arguments together
>>> as a single string before calling system() with that single argument.
>>> Then the shell would get to parse the line ...
>
>> As the man page you quoted points out, the shell is only involved when
>> the command line for system contains shell metacharacters. Martin's
>> didn't so his perl program won't use the shell.
>
> According to the bash manpage, an unquoted space character itself is a
> shell metacharacter.  A little testing shows that you're right though 
> --
> the shell is not called when the example arguments are joined together.
> I guess perl has it's own idea of what shell metacharacters are?

I guess an unquoted space character itself is a shell metacharacter 
only in so far as it acts as a separator. perl doesn't worry about 
that, because if a system command line has no OTHER shell 
metacharacters, perl splits the command line on whitespace, and calls 
execvp directly with the results of that split.


Niall




More information about the ILUG mailing list