The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error to "find" a matching array element in a directory mkbaral Shell Programming and Scripting 1 09-30-2008 02:06 PM
"find command" to find the files in the current directories but not in the "subdir" swamymns Shell Programming and Scripting 9 07-22-2008 12:23 PM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
grep to find content in between curly braces, "{" and "}," keshav_rk Shell Programming and Scripting 4 08-09-2007 11:14 PM
wrinting "ls" results on 1 line.... Nicol Shell Programming and Scripting 5 11-09-2004 05:42 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-05-2008
tret tret is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 29
Results of "find" to an array

I am looking to search a directory for a folder or file and when it finds any hits I want it to store those hits in an array so I can work with those hits later on.

I have been trying to do something like this but it isn't putting results into an array like I would like, is it syntax or is this not possible?


Code:
TARGET="MyRoot"
START_PATH="/Users/rtipton/Desktop/"

PATH_COUNT=0

find "$START_PATH" -type d \( -iname "$TARGET" \) -exec PATH_RESULTS[PATH_COUNT=$PATH_COUNT+1]=`echo {}` \;

Any ideas?
Rob
 

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0