Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!att!dptg!ulysses!ulysses.att.com!cjc From: cjc@ulysses.att.com (Chris Calabrese) Newsgroups: comp.unix.shell Subject: Re: pipe equivalent to /dev/null ??? Keywords: true and : won't work Message-ID: <13731@ulysses.att.com> Date: 13 Sep 90 13:08:40 GMT References: <8720001@hpdmd48.boi.hp.com> <3841@se-sd.SanDiego.NCR.COM> Sender: netnews@ulysses.att.com Organization: AT&T Bell Laboratories, Murray Hill Lines: 55 In article <3841@se-sd.SanDiego.NCR.COM> rns@se-sd.SanDiego.NCR.COM (Rick Schubert) writes: >In <8720001@hpdmd48.boi.hp.com> oscarh@hpdmd48.boi.hp.com (Oscar Herrera) writes: > >>Is there an equivalent 'pipe' like entity to /dev/null ? >>What I'd like to do is something like this >> anycommand | bitbucket > >I've seen responses of > anycommand | true >and > anycommand | cat >/dev/null > >What about > anycommand | : >? > >I'm not sure if this is shell-specific, but it works with the Bourne >shell and the C shell, at least on our system. > >(You mean you thought ":" was a comment indicator? Try > > : > somefilename > >) > >-- Rick Schubert (rns@se-sd.sandiego.NCR.COM) I've been following this thread for some time, and I have to say that neither '... | true' nor '... | :' will do the trick. I thought this would be obvious. 'true' and ':' don't read their stdin, thus the process feeding them would block and never run. This is hardly what happens with '/dev/null'. A slightly better approach than '... | cat > /dev/null' is a trivial program which reads its input and creates no output. In fact, I gave source to just such a program (didn't test it, though) in a previous posting in this thread. It's pretty trivial. On the other hand, ':' and 'true' are perfectly good null pipe _sources_. 'true | ...' and ': | ...' do exactly the same thing is '< /dev/null ...'. What I really want to know is in what situation you _need_ a pipe, when /dev/null already is there. The only thing I can think of is a C program which uses popen() explicity. This, of course, flies in the face of the UNIX tool building philosophy. BTW, '/bin/true' is often implemented as something like: # the true command : Name: Christopher J. Calabrese Brain loaned to: AT&T Bell Laboratories, Murray Hill, NJ att!ulysses!cjc cjc@ulysses.att.com Obligatory Quote: ``pher - gr. vb. to schlep. phospher - to schlep light.philosopher - to schlep thoughts.''