docs/133118: Error in getopt (1) manual EXAMPLES section
Oleg A. Mamontov
oleg at mamontov.net
Fri Mar 27 09:30:04 UTC 2009
>Number: 133118
>Category: docs
>Synopsis: Error in getopt (1) manual EXAMPLES section
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-doc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: doc-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 27 09:30:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Oleg A. Mamontov
>Release: FreeBSD 7.0-20080303-SNAP amd64
>Organization:
Rambler Internet Holding
>Environment:
System: FreeBSD dev2.rambler.ru 7.0-20080303-SNAP FreeBSD 7.0-20080303-SNAP #1: Tue Apr 8 13:54:52 MSD 2008 root at dev2.rambler.ru:/usr/src/sys/amd64/compile/DEV2 amd64
>Description:
The man page for getopt(1) contains incorrect example.
for i
do
case "$i"
in
...
done
Variable $@ expanded to list of options and their values (if any).
Loop variable ($i) will contain both (but should contain only options).
This invalid example was imported from NetBSD cvs in Revision 1.1:
http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/getopt/getopt.1?rev=1.1;content-type=text%2Fx-cvsweb-markup
Later this was fixed in NetBSD:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/getopt/getopt.1?rev=1.10&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
>How-To-Repeat:
>Fix:
This piece of code should look like this:
while true;
do
case "$1"
in
...
done
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-doc
mailing list