sfgroups
sfgroups

Reputation: 19099

KornShell script command line option

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]

Upvotes: 1

Views: 1068

Answers (1)

Neil
Neil

Reputation: 55392

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.

Upvotes: 3

Related Questions