Clark J. Wang <
dear...@gmail.com> wrote:
> For example:
>
> $ cat foo.sh
> optstring="[-]a:[ATTRIBUTE:listof]{[a?Attribute A][b?Attribute B]}"
> while getopts "$optstring" opt; do
> echo "$opt=$OPTARG"
> done
[...]
> $ ksh foo.sh -a a
> a=a
> $ ksh foo.sh -a a,b
> foo.sh: -a: a,b: unknown option argument value
> ?=0
> Usage: foo.sh [-a ATTRIBUTE]
[...]
> So what should be the correct syntax of a *list* here?
A similar question was asked on the ast-users mailing list a few years
ago. Here's the relevant message:
#v+
[ast-users] getopts question
Glenn Fowler gsf at
research.att.com
Wed Aug 9 14:35:19 EDT 2006
On Wed, 09 Aug 2006 13:46:16 -0400 Mario DeFazio wrote:
> I have gotten a bit further by using 2-digit numbers:
> [S:server?Operate on one or more of the specified
> \asubservices\a:]:[subservice:listof:=pmserver,repserver,notifyd] \
> {
> [31:pmserver]
> [32:repserver]
> [33:notifyd]
> }
> However, I can't specify a list of more than one service:
> $ ksh93q infa_ctl --server pmserver,repserver stop devrepdb
> infa_ctl: --server: pmserver,repserver: unknown option argument value
> I thought the 'listof' modifier supported this. What am I doing wrong?
the 'listof' refers to the option list declaration, not usage
the usage would have to be through multiple --server options
--server=pmserver --server=repserver
probably with a note on the meaning of multiple --server options
#v-
The original message is available at
<
https://mailman.research.att.com/pipermail/ast-users/2006q3/001247.html>
See the "Previous message" links for the rest of the thread.