print all nonempty pipe

I am trying to write a shell script for Linux to print the names of all non empty pipes in the current directory?

any help

ls and find - two main ways to get file information - rely on stat() which is a system call that gets information like the size of a file, file permissions, etc.

The stat call is guaranteed to return a size ONLY if the file in question is a symbolic link or if the file is a regular file. It does not work on pipes.

This means that for most Linux implementations you cannot identify non-empty pipes.

What Linux are you running?

Stat will work on some versions of Unix. Try it out. You could learn something.
Also, you should read the "special homework rules" for this site.

stat only works on Solaris pipes, AFAIK. The OP is on Linux.

If you are going to use C and not a shell script: set the pipe file descriptor non-blocking and then use select() or maybe poll() to see if the file descriptor is available to read or write. Then you do not worry about the "size" of the pipe. Which inofmration is mnot very useful anyway.

Here is some sample code to set the fd non-blocking.

//error handler 
void errchk(const int val)
{
   if (val == -1)
   {
      perror("Error on pipe");
      exit(1);
   }
}
// set fd to non blocking
void set_no_block(int fd)
{
   int fileflags=fcntl(fd, F_GETFD);

   errchk(fileflags);
   fileflags|=O_NONBLOCK;
   errchk(fcntl(fd, F_SETFD, fileflags));
}

Example use of select (this is a more generic approach for any file descriptor open for read):

The GNU C Library