How do I dynamically set up an array. Below is my code
if [[ $tsk_count -gt 0 ]]
then
set ecomm_task_limit = '${ecomm_srvr[$j]}'
fi
Here, I want to set values in the array "${ecomm_srvr[$j]}" into ecomm_task_limit upon each iteration. Finally I want to display all the values in the new array "ecomm_task_limit" after all the iterations are complete.
The following is the code snippet of an ksh array implementation,
#!/bin/ksh
set -A arr Hello world!! Iam Nagarajan Ganesan
set -A NewArray
let count=0
while [[ count -le 4 ]] ; do
NewArray[${#NewArray[*]}]=${arr[$count]};
print "NewArr[$count]= \c"
print ${NewArray[$count]}
((count=count+1))
done
print "The New Array Has: \c"
print ${NewArray[*]}
OUTPUT:
$ /tmp/arr.ksh
NewArr[0]= Hello
NewArr[1]= world!!
NewArr[2]= Iam
NewArr[3]= Nagarajan
NewArr[4]= Ganesan
The New Array Has: Hello world!! Iam Nagarajan Ganesan
Hope this may help you. Please let us know if this doesn't work
#!/bin/ksh
set -A proc $x
x=top| grep siebmtshmw |awk '{print $6}'|sed 's/\%//'
print $x
set -A proc $x
print ${proc[0]}
print ${proc[1]}
print ${proc[2]}
___
In nut shell Im trying to use top to get the desired process and then store them in a array and print them ..