View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-30-2012, 02:21 AM   #1
LQ Newbie
Registered: Apr 2012
Posts: 1

Rep: Reputation: Disabled
Assign find command output to a varaible

Hi Im trying to assign a find command output to a varaible but im unable to do so
Can someone please help me solve it


array=(vnbh5-apcpu 05-apcpu)
for item in ${array[*]}
echo $item
fileslist= find /nmis/ -name "$item.xml" -type f
echo the file is at $fileslist

Last edited by rohan1977; 04-30-2012 at 02:28 AM.
Old 04-30-2012, 02:35 AM   #2
Registered: Jun 2011
Distribution: Slackware
Posts: 471

Rep: Reputation: 185Reputation: 185
Try using this:

fileslist=$(find /nmis/ -name "$item.xml" -type f)
Keep in mind that with each iteration of the for loop the contents of $fileslist are replaced.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Output of ps command - can't find file kurk Linux - General 4 04-29-2010 01:44 PM
Piping Output of a Command Like Find cipher7836 Linux - Newbie 13 08-16-2009 04:41 AM
Perl Script command to unset ORA_NLS environment varaible rajaniyer123 Solaris / OpenSolaris 3 06-04-2009 06:30 AM
find with -exec: no command output David the H. Linux - Software 5 01-03-2008 02:53 AM
Assign command output to a varible. wilku Linux - Newbie 3 03-26-2005 12:56 PM

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration