Re: put find output in an array

how do I get this into an array?

In the Korn Shell there is an ability to execute a command and put the
results into an array:

set -A myarray $(find ./ -name "*.pl")
let count=0
while (( $count < ${#myarray[*]} )); do
echo FILE: ${myarray[count]}
let count="count + 1"

Also, you could use perl:

open FINDEM,'find ./ -name "*.pl" |' or die "Cannot open pipe: $!\n";
@findarr = <FINDEM>;
for ($i = 0; $i <= $#findarr; $i++) {
print "FILE: $findarr[$i]";

You can also use this perl:

@findarr = `find ./ -name "*.pl"`;
for ($i = 0; $i <= $#findarr; $i++) {
print "FILE: $findarr[$i]";

But, I think the backtick ( ` ) operator has been deprecated and may
not be available in current or future versions of perl. I'm using
version 5.8.0 of perl -- not sure if this is current.

I didn't use your exact find command for my testing purposes. This will
at least give you a head start.

Hope this helps.

Art Ramos