Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ptsfa.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!sdcrdcf!hplabs!intelca!qantel!dual!ptsfa!dsp From: dsp@ptsfa.UUCP (David St.Pierre) Newsgroups: net.followup,net.unix Subject: Re: ksh availability Message-ID: <510@ptsfa.UUCP> Date: Wed, 13-Mar-85 10:19:19 EST Article-I.D.: ptsfa.510 Posted: Wed Mar 13 10:19:19 1985 Date-Received: Mon, 25-Mar-85 02:37:19 EST References: <10005@ulysses.UUCP> <15757@mgweed.UUCP> <9071@brl-tgr.ARPA> Reply-To: dsp@ptsfa.UUCP (David St.Pierre) Organization: Pacific Telesis, San Francisco Lines: 37 Xref: watmath net.followup:4692 net.unix:4018 Summary: One of the modes ksh uses to define functions is compatible with SV_R2. A nice additional feature is the ability to define an ENV variable which points to a file of functions. This effectively allows functions to continue to be defined across sub-shells. If you use 5620 layers or shl, you will begin to appreciate this. I have run across an inconsistency between ksh and sh. I would be grepping for a particular string in a large file, creating a temporary sub-file. If I found more than one match, I wanted to provide a selection mechanism at the terminal. The following (abbreviated) fragment shows what I did: PROFSIDS=/usr/ladm/lib/profs_ids TMPB=yyy grep -i "$1" $PROFSIDS > $TMPB while : do read USERID SYSTEM NAME if [ -z "$USERID" ] then break fi echo "NAME = $NAME, USERID = $USERID [y] \c" read ANS < /dev/tty if [ "$ANS" = "n" ] then continue fi echo "The answer was $ANS" done < $TMPB In "sh", I got the results I wanted. In ksh, $TMPB was closed after a single line was read, presumably because /dev/tty was opened in the inner loop. I'm not sure if this is a bug or feature. And my copy of ksh may have no resemblance to the version being offered in the toolchest.