title: Assign value to a variable in a for loop via KornShell
body: <p>I am having problem when trying to assign a value to a variable in a loop. It will be like using variable inside a variable. So I created an array to add the values still something is not right. </p>
  
  <p>Please take a look at the following KornShell (ksh) script and let me know where did I mess up</p>
  
  <pre><code>#!/usr/bin/ksh
  set -A array $1 $2 $3
  set -A values
  typeset -i a
  
  a=0;
  for files in ${array[@]}
  do
  cd ~/shell_lib
  ls | grep $files
  ${values[$a]}="$(cksum $files)" 
  a=$a+1
  done
  
  echo ${values[@]}
  </code></pre>
  
  <p><strong>OUTPUT</strong></p>
  
  <hr>
  
  <pre><code>$ ./intarray.sh forall.sh name.sh 
  forall.sh
  ./intarray.sh[12]: =3311936491 251 forall.sh:  not found
  name.sh
  ./intarray.sh[12]: =3294813710 338 name.sh:  not found
  </code></pre>
  
  <p>The file is there and it has done the cksum, but still it says not found! I can not understand what is wrong! Any insight?</p>