![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| redirect the grep output into the variable | mail2sant | Shell Programming and Scripting | 1 | 04-08-2008 09:46 AM |
| redirect output of dos2unix command | nrbhole | Shell Programming and Scripting | 4 | 01-25-2008 09:30 AM |
| awk redirect output to shell variable | dhinge | Shell Programming and Scripting | 3 | 12-09-2006 12:11 PM |
| Redirect Output In Variable | ZINGARO | UNIX for Dummies Questions & Answers | 1 | 08-02-2006 06:56 AM |
| Redirect from Variable to command line?? | ugh | UNIX for Dummies Questions & Answers | 8 | 03-28-2006 10:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
redirect command output to variable
Hi,
I am looking for a way to redirect the result from a command into a variable. This is the scenario. Using the find command I will be getting multiple records/lines back. Here is the command I am using: find /”path”/ -name nohup.out –print This now is giving me the paths and file names back as a record/line. Ex. /”path1”/ nohup.out /”path2”/ nohup.out /”path3”/ nohup.out I would like to pass these records/lines into a variable line for line and then use the variable line for line in another command echo. The result would be that I will echo info into the nohup.out files. Please will you assist me with this? Thank you for your assistance. Hugo |
|
||||
|
You could try
for variable in $(find) do array[counter]=variable done You then have an associative array that contains all the values. Obviously you would need to set up a counter for the subscript. If you're interested in dynamically creating variable names, please note one of my earlier posts on this subject. It is incredibly powerful, especially when using common code modules in shell scripting: www.unix.com - Faux hash table Last edited by Simerian; 06-22-2005 at 08:37 AM.. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|