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

Korn Shell Array Help

Status
Not open for further replies.

uuperl

Programmer
Feb 20, 2006
33
US
Hi,

#!/bin/sh

set -A line1 two three four five
set -A line2 a b c d e f

print "Enter your array name"
read arrayname

print ${$arrayname[0]}

Question:
Can I use $arrayname? Somehow it does not work.

thanks!
 
I got the solution from another post in this forum:

should be:

eval print \${$arrayname[0]}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top