Suppose I have a Unix shell variable as below
variable=abc,def,ghij
I want to extract all the values (abc, def an
abc
def
Here is an alternative tr based solution that doesn't use echo, expressed as a one-liner.
for v in $(tr ',' '\n' <<< "$var") ; do something_with "$v" ; done
It feels tidier without echo but that is just my personal preference.