tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ sh alias

copying stderr to file? ▻

using mknod

In article <87ovp6$b7e$1@nnrp1.deja.com>,  <peter_sands@my-deja.com> wrote:
>Yes , what I am trying to do is this in a nutshell;
>Use find to put selected filename into  a pipe, so that another script
>can collect the filenames and process later.

Hmm... your use of the word "later" suggests that you may have
misunderstood how named pipes work.  Like a normal pipe, they can only
buffer a certain amount of data, so you need both a reader and a writer.

If there is no reader, the writer will block till there is.

>mknod /tmp/pipefile p
>chmod 664 /tmp/pipefile
> find apps/logs -name "*.ARP" -print >/tmp/pipefile &

That looks OK, and it works for me.

    ; mknod /tmp/pipefile p
    ; find /tmp -print > /tmp/pipefile
    <this command now blocks>

In another window, I say this.  As the `cat' finishes, so does the
`find' in the first window.

    ; cat /tmp/pipefile
    /tmp
    /tmp/wilytjg:0
    ...

>Using the above commands it eithers;
>hangs

Yup, this is what I'd expect if there is no reader for the pipe.

>or
>returns cannot create

You can only create the pipe once.

    ; mknod /tmp/pipefile p
    ; mknod /tmp/pipefile p
    mknod: /tmp/pipefile: File exists

Hope this helps!

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: using mknod
Date: 8 Feb 2000 16:09:15 -0000
Message-ID: <87pf41$o91$1@ltpcg.star.le.ac.uk>
References: <87mh79$gn8$1@nnrp1.deja.com>
  <87mr1m$jeo$1@ltpcg.star.le.ac.uk> <87ovp6$b7e$1@nnrp1.deja.com>

△ comp.unix.shell △

◅ sh alias

copying stderr to file? ▻