While read -a line not working in ksh

while read -a line; 

this is not working in ksh. what is the equivalent of this in ksh.

read: -a: unknown option

You could try:

read words
set -A my_array $(printf "%s " $words)

eg:

$ read words
zero one two three

$ set -A my_array $(printf "%s " $words)
$ echo ${my_array[0]} ${my_array[3]}
zero three
1 Like

My version of ksh:

Version AJM 93u+ 2012-08-01

From the man page:

       read  [  -ACSprsv  ] [ -d delim] [ -n n] [ [ -N n] [ [ -t timeout] [ -u
       unit] [ vname?prompt ] [ vname ... ]
              ...
              nal device.  The -A option causes the variable vname to be unset
              and each field that is read to be stored in successive  elements
              of  the  indexed array vname.  ...

So instead of

read -a arr

use

read -A arr

Andrew