1

I want a command line option like this one in the following KornShell (ksh) script. I know we can use getopts for single hypen. What is the beast way to use both command line option?

script [-u|--upload] [-r|--run] [-d|--diskinfo] 
1
  • your tags are confusing, what do bash and perl have to do with anything for a ksh script? Commented Jun 14, 2011 at 22:39

1 Answer 1

3

getopts -l, --longoptions longopts

The long (multi-character) options to be recognised. More than one option name may be specified at once, by separating the names with commas. This option may be given more than once, the longopts are cumulative. Each long option name in longopts may be followed by one colon to indicate it has a required argument, and by two colons to indicate it has an optional argument.

Sign up to request clarification or add additional context in comments.

1 Comment

Working complex example using getopt (similar to getopts)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.