zsh-workers
 help / color / mirror / code / Atom feed
* Question about getopts in 3.0.2
@ 1997-08-26  1:19 Clint Olsen
  0 siblings, 0 replies; only message in thread
From: Clint Olsen @ 1997-08-26  1:19 UTC (permalink / raw)
  To: zsh-workers

I tried reading the FAQ.  Didn't see anything pertaining to this.

I'm having trouble using getopts in the case where it requires an argument:

while getopts :G2rd: OPT
do
  case $OPT in
   '2'|'r'|'G') GENARG=($GENARG -$OPT) ;;
    'd') echo printer is $OPTARG ;; #LPARG=-d$OPTARG ;;
    '?') echo $0:t: Unknown option $OPTARG; exit 1 ;; 
    ':') echo $0:t: Option required for $OPTARG; exit 1 ;;
  esac
done

In the case of d, OPTARG is generally unusable/trashed when I don't think
it should be.  For example, lp -dlwfoo produces a null OPTARG and lp -d
lwfoo produces and error "Unknown option l".  What am I doing wrong?

Thanks,

-Clint


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-08-26  1:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-26  1:19 Question about getopts in 3.0.2 Clint Olsen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).