on-internet
← Community

How do I use getopts with long strings?

Stack Overflow ·

I'm using Getopt::Std to process my command line args. My command line args are strings. I have an issue with getopts(), as it works only for single character based opts. As seen below "srcdir" "targetdir" options are mandatory and script should error out if any one of them is missing. "block" is NOT a mandatory option. I don't see %options is being set with the code below, and all my options{key} are NULL. Had I replaced "srcdir" with "s" and "targetdir" with "t", then the below piece of code works. It doesn't work with "-srcdir" "-targetdir" options. What's the best way to address the issue

Comments

Sign in or sign up to comment and upvote.

No comments yet.