> 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