Wouldn't it work to do the system call like this:

system( 'md5',$file );

since passing the params as a list should bypass the shell?

-- 
David Dierauer
Database Programmer
CoreComm
[EMAIL PROTECTED]
517-324-8957

On Fri, 28 Mar 2003, Jerry LeVan wrote:

> > Let's say that I want to use a command (e.g., md5) on a file.  No
> > problem; just use:
> >
> >  system("md5 $file");
> >
> > Except that the file name could contain all manner of white space
> > characters, shell wildcard characters, etc.  Is there a module that
> > deals with this sort of thing (e.g., wrapping each argument in the
> > appropriate kinds of quoting)?
> >
> > -r
> >
> > P.S.  This isn't strictly an OSX issue, but I see far more weird
> >      characters in OSX file names than I ever saw in *BSD, etc.
>
> Yeah, this probably has some holes...
>
>     # to be safe, quote shell metacharacters
>     $command =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'"])/\\$1/g;
>     Parse($command);
>
> --Jerry
>
>

Reply via email to