On Fri, Feb 08, 2002 at 08:13:17AM -0600, Pfeiffer, Richard wrote:
> My command line looks similar to this:
> command.pl    -r"z:\Tech Team"   -p"/Tools Team"   -f"File Found Today.txt"
> -v"RDP 1.2_A"
> 
> What I'm trying to check for is to make sure when people run my script, they
> have each option surrounded by the double quotes, as you see above.

Why is it you need to check for that?  Isn't it enough that the arguments
have gotten to your program in one piece?  See below.


> To check this, I was at first trying to see what $opt_r as returned by
> 'getopts' was set to, but it strips off my quotes automatically, so there
> is no way to see what was actually input vs what is interpreted.

getopts doesn't do the stripping, your shell's doing that.  It's using the
double quotes to determine where arguments begin and end.  Your command line
above effectively becomes:

    @ARGV = (
        '-rz:\Tech Team',
        '-p/Tools Team',
        '-fFile Found Today.txt',
        '-vRDP 1.2_A'
    );


[snip]
> That way, if my command line was bad and looked like this: (Notice missing
> quote between -rz right after command.pl)  
> command.pl    -rz:\Tech Team"   -p"/Tools Team"   -f"File Found Today.txt"
> -v"RDP 1.2_A"

If this were the case, the shell would complain about unbalanced quoting. 
command.pl would never be executed.

 
> ARGV[0] would return:
> -rz:\Tech Team"
> and I would be able to catch the missing quote error.

Well if that's all you want the ability for, the shell is already handling
it for you.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to