From: vince@victrola.sea.wa.us (Vince Skahan) Subject: ksh is broken (???) Date: Sun, 14 Mar 1993 06:47:57 GMT
the following script is from page 61 in the
Bolsky+Korn book "The Korn Shell Command and
Programming Language"...
It works under ultrix, but not on the pdksh4.7
under linux...anybody know if this is a known
bug in the pdksh or if there's a better ksh available ?
KSH_VERSION=@(#)PD KSH v4.7 92/08/12
also, there are some things missing from it
(ie...'typeset -u' isn't valid)
#------------------- cut here --------------------------
#!/bin/ksh
#
# this prints a random card under ultrix but
# nothing under linux. It appears that
# the 'i' in card[i] isn't getting evaluated
# when it's supposed to be filling the array
#
# try ksh -xv thisfile to see what I mean...
#
integer i=0
for suit in clubs diamonds hearts spades
do for n in ace 2 3 4 5 6 7 8 9 10 jack queen king
do card[i]="$n of $suit"
i=i+1
done
done
print - ${card[RANDOM%52]}
#--------------------------- end ----------------------------
--
---------- Vince Skahan --------- vince@victrola.sea.wa.us ----------
+++ A Waffle Iron - Linux Division +++