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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture and parse the array element from shell script

Status
Not open for further replies.

pho01

Programmer
Mar 17, 2003
218
US
I have a shell script that returns the output of a database query in array. How does array work in shell script? How do I parse and capture the array element?

Thanks,
 
Assuming the array is named MYarray


${#MYarray[*]} evaluates to number of array elements
${MYarray[@]} evaluates to all array elements
${MYarray[*]} evaluates to all array elements
${MYarray} evaluates to the array element indexed by $sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top