Help with variable assignment

Hi,

In AIX I have a variable with , (coma) separated values assigned to it like shown below

var1=apple,boy,chris
i want to convert this to
var1='apple','boy','chris'

the number of values assigned to var1 might change and it could be from 1 to n

any suggestions please?

quick solution:

var1=apple,boy,chris

var1=`echo $var1 | sed "s/,/','/g"`

var1=`echo "'"$var1"'"`

echo $var1    # Now it holds :  'apple','boy','chris'

Thank you !!

var1=$(echo "$var1" | sed "s/[^,]*/'&'/g")