broken pipe?

Hi there,

I try to use:
> find * | ls
but it just gave me one level of ' ls '. and it said:

> find * | ls
dir1 dir2 f1 f2 f3
Broken Pipe
>

what is broken pipe?
how can i fix it?

thks

Gusla

Use a big wrench! :stuck_out_tongue:

Seriously, though, you shouldn't have to pipe find to ls.
Also, you should use "find .", since it will begin in ".", the current directory.

Check the man page for find. If you wanted a long listing, for example, you could use either of these commands:

find . -exec ls -l {} \;
find . | xargs ls -l

You can also narrow it down to type files, or just directories:
find . -type f -exec ls -l {} \;
find . -type d -exec ls -l {} \;

Hope this helps.

thks Freelive.

my initial purpose is wanted to pipe the files to a perl program.

see, say my perl program is getfile.pl (taking file names as argumemnts)

# getfile.pl
#!/usr/bin/perl -w
 while ($ARGV = shift)
 {
        print "\nprocessing $ARGV...";
        if (-d $ARGV)
        {
           print "\n$ARGV is a DIR\n";
         }
 }

if i use:
> getfile.pl f1 f2 dir1 dir2
to execute the perl file, it's working.

However, if i use:
> ls | getfile.pl OR >find * | getfile.pl
it's not working. It wouldn't recoglise the input argument (@ARGV is empty)

also
>getfile.pl < f1 f2 dir1 dir2

it only recognise f2, dir1, dir2. The first argument f1 is missing. (ie. @ARGV only contains f2, dir1 and dir2)

WHY?

appreciate as usual

Gusla
:rolleyes:

added code tags for readability --oombera

Sorry, I'm not a perl kinda guy...

Hopefully someone else can help here...