ksh availability
David St.Pierre
dsp at ptsfa.UUCP
Thu Mar 14 01:19:19 AEST 1985
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.
More information about the Comp.unix
mailing list