Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Splitting up quoted/escaped command line arguments

by Tommy (Chaplain)
on Feb 11, 2014 at 18:57 UTC ( #1074471=note: print w/ replies, xml ) Need Help??


in reply to Re: Splitting up quoted/escaped command line arguments
in thread Splitting up quoted/escaped command line arguments

Without knowing the name for it, I have already started trying to put together a state machine. I called it a "peel off" approach where I look through the string and peel things off one at a time, making sure to note and handle quoted things when I encounter them. I haven't got very far with it yet--just a few minutes working on the idea.

Tommy
A mistake can be valuable or costly, depending on how faithfully you pursue correction


Comment on Re^2: Splitting up quoted/escaped command line arguments
Download Code
Re^3: Splitting up quoted/escaped command line arguments
by Tommy (Chaplain) on Feb 11, 2014 at 19:31 UTC

    OK. This mixture of approaches seems to be working so far: I haven't been able to break it yet. Can anyone break this?

    (Please see UPDATE 2 to the OP)

    Tommy
    A mistake can be valuable or costly, depending on how faithfully you pursue correction
      'a'\''b' Seems to break update 4.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        That's ok with me, because in Linux-ese (bash/sh/ksh), you can't escape a single quote. It's one of the most annoying things and I find it reeeally bothersome. This is why I don't try to accommodate for a "\'" sequence in update 4. Despite the fact that I don't want these commands to go to the shell, they are being written by people who deal with the shell almost exclusively: system admins. This much I can assume: that they won't be putting in commands that have syntax which outright fails to run on its own.

        Tommy
        A mistake can be valuable or costly, depending on how faithfully you pursue correction

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2014-12-22 16:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (121 votes), past polls