Reading comma separated variable into other variables in shell script
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.
var = inn, day, grocery
I would like to read it like
var1 = inn, var2 = day, var3 = grocery
var = day, grocery, store, road, highway
I would like to read it as
var1 = day, var2 = grocery, var3 = store, var4 = road, var5 = highway