bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mkfifo and tee within a function


From: Nathan Coulter
Subject: Re: mkfifo and tee within a function
Date: Thu, 30 Nov 2006 18:23:00 +0000

>  -------Original Message-------
>  From: Nathan Coulter <org.gnu.lists.bug-bash@pooryorick.com>
>  Subject: Re: mkfifo and tee within a function
>  Sent: 2006-11-28 17:19

>  I think that is true for an anonymous pipe, but not for a named pipe.  
> Timing is not the issue here.  A command which opens a named pipe for writing 
> should block until a reader comes online.  In the following example, I get an 
> error with "source', but not with "cat".  Why?
>  
>  $>cmd_print () { mkfifo zout; tee zout & cat zout >/dev/null ; rm zout; }
>  $>cmd_print <<EOF
>  > date
>  > EOF
>  [1] 5263
>  date
>  [1]+  Done                    tee zout
>  $>cmd_print () { mkfifo zout; tee zout & source zout ; rm zout; }
>  $>cmd_print <<EOF
>  > date
>  > EOF
>  [1] 5267
>  $>date
>  tee: zout: Broken pipe
>  

In the following example, I get different output depending on whether I source 
the script or invoke it.  Is there an explanation for this or is it a bug?

$>cat test1
#!/bin/bash

cmd_print () { mkfifo zout; tee zout & cat zout; rm zout; }
cmd_print <<EOF
date
EOF
$>source test1
date
date
[1]+  Done                    tee zout
$>./test1
$>

-- 
Nathan Coulter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]