![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing value in a variable | gehlnar | Shell Programming and Scripting | 2 | 02-04-2009 12:22 PM |
| Storing Command Line Values | yoursdavinder | Shell Programming and Scripting | 3 | 01-30-2009 07:33 AM |
| storing a command in a variable | nookie | Shell Programming and Scripting | 2 | 10-11-2008 11:55 AM |
| Storing a variable? | hoover90 | Shell Programming and Scripting | 4 | 01-26-2008 09:39 PM |
| Storing values in variable | matrixmadhan | Shell Programming and Scripting | 1 | 04-01-2005 02:56 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Storing Multiple Values in a Variable
Hi,
My code is as below: integer i=7 while ((i <= 5 )); do # test_out is a variable which contains data separated by "^". a= `echo $test_out | cut -d"^" -f$i` echo "$a" (( i = i + 1)); done From the above code, i kept $i after f so that i can capture all the data which is separated by "^". Here since "i" is incrementing 5 times, i want to store all the 5 values in variables such as a1,a2,a3,a4,a5 . How can i do this. If i keep "i" after a it is not working. Ideally instead of keeping 5 commands for a, i want to do it in single shot by keeping ai. But it is not working. If i do an echo "$ai", it must display all the 5 values since its looping 5 times. Correct me if i mentioned some thing wrong. I am new to UNIX so it would be great if some body can help me out. Thanks Sandeep |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|