ghe@physics.orst.edu (Guangliang He) (11/08/90)
I'm starting to learn ksh on a RS/6000 with AIX 3.1. I typed in a piece of script from 'The Korn Shell' by Morris I. Bolsky & David G. Korn. The output of the script is not what I would expect. The shell script is on page 216 of the book. Script started on Wed Nov 07 17:27:40 1990 1$ cat bug #!/bin/ksh while getopts :abo: c do case $c in a) aflag=1;; +a) aflag=;; b) bflag=1;; +b) bflag=;; o) oflag=$OPTARG;; :) print -u2 "$0: $OPTARG requires a value:" exit 2;; \?) print -u2 "$0: unknow option $OPTARG" exit 2;; esac done shift OPTIND-1 2$ bug 3$ bug -a 4$ bug -b 5$ bug -c ./bug: unknow option 6$ bug -o ./bug: requires a value: 7$ bug -o 1 8$ script done on Wed Nov 07 17:28:08 1990 Look at command number 5 and number 6. It seems that $OPTARG was not assigned even though the first argument after getopts begins with character ':'. This is different from what the book, and the man page on the AIX machine. Any one can come up with reasonable answer? Guangliang He ghe@PHYSICS.ORST.EDU Guangliang He ghe@PHYSICS.ORST.EDU hegl@ORSTVM.BITNET
news@usenet.ins.cwru.edu (11/12/90)
In article <21641@orstcs.CS.ORST.EDU> ghe@physics.orst.edu (Guangliang He) writes: >I'm starting to learn ksh on a RS/6000 with AIX 3.1. I typed in a piece of >script from 'The Korn Shell' by Morris I. Bolsky & David G. Korn. The >output of the script is not what I would expect. The shell script is on >page 216 of the book. The version of ksh shipped with AIX 3.1 is `11/16/88 NLS', which is basically Korn's initial release + IBM internationalization stuff. According to the ksh changelog, posted to comp.unix.shell by Larry Cipriani, this bug was fixed in ksh 11/16/88a to "agree with the man page". There are quite a lot of ksh-88 fixes; it's now up to version 11/16/88e. I imagine IBM will eventually upgrade to a more recent base release. Chet -- Chet Ramey ``I die, Horatio'' Network Services Group, Case Western Reserve University chet@ins.CWRU.Edu My opinions are just those, and mine alone.