lkml.org 
[lkml]   [2001]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Need blocking /dev/null
On Thu, Nov 01, 2001 at 11:51:39PM +0000, you [Riley Williams] claimed:

(Piping only stderr to a program)

> Also, even if it's true, is that also true with all other possible
> shells?

I think the point is it can be made to work in userland, not that a
particular shell isn't able to do that. In fact, I'm a bit dissapointed
that shells such as zsh and bash seem to lack an easy way to do that. But
really, this is theoretical, I think nobody is really advocating getting rid
of /dev/null and /dev/zero.

> Redirecting to /dev/null is independant of the shells, but piping hacks
> like that aren't.

The way I see it piping is independent from shells just because it can be
accomplished in userland using the present linux system calls.

> So it should be deliberately written to write them out in an infinite
> loop? Makes a bizarre sort of sense, but not something I would ever do.

Why is that? I see nothing bizarre in that.

> Also, as I've had pointed out to me, one sometimes needs to tell a
> program to take input other than stdin from /dev/zero and that often
> can't be done using pipes. The friend who pointed this out to me
> recently had reason to do precicely this. The following isn't exactly
> what he needed, but is similar...
>
> Q> ebcdic2ascii < /dev/ttyS1 | tr A-Z a-z | bindiff /dev/zero /dev/stdin

Again, I think it can be done in userland. Some shells even give you
convenient syntax for that. This works in zsh:

head -2 <(yes) <(uname)
==> /proc/self/fd/11 <==
y
y

==> /proc/self/fd/12 <==
Linux

So you can pipe arbitrary program output as a filename argument.

I guess you example could be written as

ebcdic2ascii < /dev/ttyS1 | tr A-Z a-z | bindiff <(zerofill) /dev/stdin

but I'm not sure since I have no idea your example does ;) ;).

> > I'm still happy to keep /dev/null and /dev/zero. ;)
>
> So am I.


-- v --

v@iki.fi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:12    [W:0.078 / U:13.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site