Hi,
In shell script, I have a variable var = xyz, inn, day, night, calif ....n and I would like to read them in to var1 = xzy, var2 = inn, var3= day, var4 = night....var[n].
probably in a loop. I would like to read the variables until end of the line. Comma is the delimiter and there's no comma at the end.
For example:
var = inn, day, grocery
I would like to read it like
var1 = inn, var2 = day, var3 = grocery
Another case:
var = day, grocery, store, road, highway
#!/bin/ksh
var=day,grocery,store,road,highway
IFSsave="$IFS"
IFS=,
set -A vars $var
IFS="$IFSsave"
i=0
while [ $i -lt ${#vars[@]} ]
do
echo var$i=${vars}
let i=i+1
done