Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set an array in ksh from a list of comma separated values

Status
Not open for further replies.

Muskaan

Programmer
Oct 21, 2002
47
0
0
US
Hi all, I have set an array in ksh using the "set -A" command when the set of values are space delimited, as follows:
set -A array_test $(echo "first second third")

is it possible to do something similarly simple in case my set of values is comma separated like so: "first,second,third"

thanks in advance!
Muskaan

***Most problems are nothing but lack of ideas***
 
Hey I got the solution. For those who care:
set -A array_test $(echo "first,second,third" | tr ',' ' ')


***Most problems are nothing but lack of ideas***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top