in reply to Mimicking Unix shell quoting in Perl

Shell::Parser
  • Comment on Re: Mimicking Unix shell quoting in Perl

Replies are listed 'Best First'.
Re^2: Mimicking Unix shell quoting in Perl
by halley (Prior) on Aug 20, 2007 at 13:17 UTC
    Looking at Shell::Parser leaves me empty inside. It looks like a very lightweight wrapper around lexical analysis. It doesn't appear to do any glob syntax expansion like eyepopslikeamosquito wanted.

    Not only does bash globbing syntax handle foo*.jpg but it deals with foo?.jpg and foo[1-5][xyz].jpg and even foo.{jpg,jpeg} options too. It's a pretty complicated feature, even if you skip all the $VAR interpolation stuff.

    Speaking of which, eyepopslikeamosquito, is it important for your purposes to do things exactly like the shell? Can you assume you're on a platform that actually has the shell, or must you work smoothly on Win/DOS too? You could just shell out a string to xargs, but this is a significant taint-checking exercise too.

    --
    [ e d @ h a l l e y . c c ]

      The Windows shell doesn't do glob. So even a module that doesn't handle globbing can still be much like a "real shell". It just depends on what you use as a role model. :)