Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Dec 1996 13:01:13 -0800
From:      Keith Walker <kew@timesink.spk.wa.us>
To:        freebsd-current@freebsd.org
Subject:   Problem with /bin/sh's getopts builtin
Message-ID:  <199612182101.NAA00876@phobos.walker.org>

next in thread | raw e-mail | index | archive | help
So, am I the only one who is having trouble with sh's getopts command
not working? As of a couple of weeks ago, or at least somewhere
between 2.2-SNAP-101496 and 3.0-Current, the getopts command stopped
working correctly for me.

As an offer of proof, I commented out the last line of the /usr/bin/lp
command (*not* lpr, but lp, the POSIX compat command) so it wouldn't
actually print anything, then did the following:

Script started on Wed Dec 18 12:49:14 1996
phobos:/usr/bin# sh -x lp -o
+ ncopies=
+ symlink=-s
+ dest=lp
+ getopts cd:n:o: option
+ shift 0
phobos:/usr/bin# sh -x lp -c
+ ncopies=
+ symlink=-s
+ dest=lp
+ getopts cd:n:o: option
+ shift 0
phobos:/usr/bin#
Script done on Wed Dec 18 12:49:58 1996

Notice the lack of any action on the part of getopts, including it not
noticing that I didn't give the "-o" option an argument on the first
try. 

Could someone try it out on their system? I don't know if I've got
something misconfigured or maybe this is some strange POSIX compliancy
issue.

keith.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612182101.NAA00876>