Jun 2, 2004 #1 shaoji Programmer Mar 22, 2004 10 US How could I put a variable as part of a variable? I know I can do this: for i in a b c; do eval a$i=foo$i done echo $aa $ab $ac It will print out fooa foob fooc. But how could I get it using variable? I cannot use echo $a$i or p=\$a$i echo $p any idea? Thanks.
How could I put a variable as part of a variable? I know I can do this: for i in a b c; do eval a$i=foo$i done echo $aa $ab $ac It will print out fooa foob fooc. But how could I get it using variable? I cannot use echo $a$i or p=\$a$i echo $p any idea? Thanks.
Jun 3, 2004 #2 PHV MIS Nov 8, 2002 53,708 FR Something like this ? for i in a b c; do eval a$i=foo$i done for i in a b c; do eval p=\$a$i echo "p=$p" done Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Something like this ? for i in a b c; do eval a$i=foo$i done for i in a b c; do eval p=\$a$i echo "p=$p" done Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Jun 3, 2004 Thread starter #3 shaoji Programmer Mar 22, 2004 10 US Thanks PH, it helps. Upvote 0 Downvote