Thread View: comp.unix.shell
16 messages
16 total messages
Started by Oscar Herrera
Sun, 09 Sep 1990 18:00
pipe equivalent to /dev/null ???
Author: Oscar Herrera
Date: Sun, 09 Sep 1990 18:00
Date: Sun, 09 Sep 1990 18:00
5 lines
513 bytes
513 bytes
Is there an equivalent 'pipe' like entity to /dev/null ? What I'd like to do is something like this anycommand | bitbucket Oscar Herrera
Re: pipe equivalent to /dev/null ???
Author: Oscar Herrera
Date: Sun, 09 Sep 1990 18:35
Date: Sun, 09 Sep 1990 18:35
18 lines
782 bytes
782 bytes
||Is there an equivalent 'pipe' like entity to /dev/null ? ||What I'd like to do is something like this || anycommand | bitbucket || ||Oscar Herrera ||---------- Well, I found the answer to my own question. touch bitbucket chmod +x bitbucket Then ll | bitbucket works well. Oscar Herrera
Re: pipe equivalent to /dev/null ???
Author: Chris Calabrese
Date: Mon, 10 Sep 1990 13:11
Date: Mon, 10 Sep 1990 13:11
18 lines
892 bytes
892 bytes
How about:
... | cat > /dev/null
Always works for me.
Short of that, it should be a trivial C program.
Something like:
main() {
char buffer[1024];
while(! read(0, buffer, 1024))
continue;
}
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.''
Re: pipe equivalent to /dev/null ???
Author: Dave Sill
Date: Mon, 10 Sep 1990 15:50
Date: Mon, 10 Sep 1990 15:50
15 lines
911 bytes
911 bytes
In article <8720002@hpdmd48.boi.hp.com>, oscarh@hpdmd48.boi.hp.com (Oscar Herrera) writes: >||Is there an equivalent 'pipe' like entity to /dev/null ? > >> touch bitbucket > chmod +x bitbucket > > Then > ll | bitbucket Even better, use `true'. It's already there. -- Dave Sill (de5@ornl.gov) Martin Marietta Energy Systems Workstation Support
Re: pipe equivalent to /dev/null ???
Author: Leslie Mikesell
Date: Tue, 11 Sep 1990 01:38
Date: Tue, 11 Sep 1990 01:38
22 lines
1276 bytes
1276 bytes
In article <8720002@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 > Well, I found the answer to my own question. > touch bitbucket > chmod +x bitbucket > Then > ll | bitbucket > works well. This will work only so long as the process generating the output doesn't generate enough data to fill a pipe buffer. Since your "null" program isn't actually going to read anything, when the pipe fills, the writing program will block. A more reasonable method would be to use "|cat >/dev/null", though the result is the same as a simple ">/dev/null". Why did you want the pipe, anyway? Les Mikesell les@chinet.chi.il.us
Re: pipe equivalent to /dev/null ???
Author: David Brooks
Date: Tue, 11 Sep 1990 14:40
Date: Tue, 11 Sep 1990 14:40
21 lines
1190 bytes
1190 bytes
In article <1990Sep11.013805.3594@chinet.chi.il.us>, les@chinet.chi.il.us (Leslie Mikesell) writes: |> In article <8720002@hpdmd48.boi.hp.com> oscarh@hpdmd48.boi.hp.com (Oscar Herrera) writes: |> |> >||Is there an equivalent 'pipe' like entity to /dev/null ? |> A more reasonable method would be to use "|cat >/dev/null", though the |> result is the same as a simple ">/dev/null". If you want to save keystrokes at the expense of compute time: |sed d Not relevant if you are putting it in a script, though. (several :-), by the way). -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks Experience Hackvergnuegen!
Re: pipe equivalent to /dev/null ???
Author: Oscar Herrera
Date: Tue, 11 Sep 1990 14:52
Date: Tue, 11 Sep 1990 14:52
17 lines
1016 bytes
1016 bytes
|A more reasonable method would be to use "|cat >/dev/null", though the |result is the same as a simple ">/dev/null". Why did you want the |pipe, anyway? | |Les Mikesell | les@chinet.chi.il.us |---------- Thanks for all the responses. I wanted to use a pipe because I wanted to bitbucket the output of an RMBUX command. It turns out that RMBUX programmatic output redirection requires a statement like PRINTER IS "| ... involving a pipe. The final solution I used was PRINTER IS "| cat >/dev/null" Oscar Herrera oscarh@hpdmmad
Re: pipe equivalent to /dev/null ???
Author: Rick Schubert
Date: Tue, 11 Sep 1990 19:52
Date: Tue, 11 Sep 1990 19:52
25 lines
1031 bytes
1031 bytes
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)
Re: pipe equivalent to /dev/null ???
Author: Randal Schwartz
Date: Tue, 11 Sep 1990 20:13
Date: Tue, 11 Sep 1990 20:13
41 lines
1672 bytes
1672 bytes
In article <8720002@hpdmd48.boi.hp.com>, oscarh@hpdmd48 (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 | || | ||Oscar Herrera | ||---------- | | Well, I found the answer to my own question. | | touch bitbucket | chmod +x bitbucket | | Then | ll | bitbucket | | works well. Until the ll output pipe fills up. My first suggestion is "why?" For example, if I wanted the ll output to go nowhere, I would type: ll >/dev/null Second, if you *really* need a process, use cat >/dev/null as in: ll | cat >/dev/null yucky yucky kludge. But it fits your requested parameters. Just another Unix hacker, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/
Re: pipe equivalent to /dev/null ???
Author: joseph.a.brownlee
Date: Thu, 13 Sep 1990 12:22
Date: Thu, 13 Sep 1990 12:22
28 lines
1515 bytes
1515 bytes
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. Yes, that works, and it works in the Korn shell as well. At least in the context shown above, it is logically equivalent to the "anycommand | true" case. -- - _ Joe Brownlee, Analysts International Corp. @ AT&T Network Systems /_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461 / \ | \_, E-mail: jbr@cblph.att.com Who pays attention to what _I_ say? "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
Re: pipe equivalent to /dev/null ???
Author: Chris Calabrese
Date: Thu, 13 Sep 1990 13:08
Date: Thu, 13 Sep 1990 13:08
55 lines
2484 bytes
2484 bytes
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.''
Re: pipe equivalent to /dev/null ???
Author: Dave Lee
Date: Thu, 13 Sep 1990 23:08
Date: Thu, 13 Sep 1990 23:08
49 lines
1609 bytes
1609 bytes
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. > Beautiful !. Elegent and clean. (Although I still dont know why ">/dev/null" wont do...) I Tried this in /bin/csh on a HP-UX 7.0 system 9000/345 and got the most interesting message Reset tty pgrp from 391 to 366 Then a quick "Jobs" command gives [2] -Broken pipe yes | Another quick "Jobs" shows nothing. a strings on /bin/csh shows Reset tty pgrp from %d to %d Just what is this trying to say? Am I supposed to change prgrp or is the shell just telling me it has. Which shell, the parent or the forked ":" ?. -- Dave Lee uunet!dptechno!dave
Re: pipe equivalent to /dev/null ???
Author: Dave Eisen
Date: Sat, 15 Sep 1990 19:37
Date: Sat, 15 Sep 1990 19:37
23 lines
1603 bytes
1603 bytes
In article <1990Sep11.013805.3594@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >In article <8720002@hpdmd48.boi.hp.com> oscarh@hpdmd48.boi.hp.com (Oscar Herrera) writes: > >> Well, I found the answer to my own question. >> touch bitbucket >> chmod +x bitbucket >> ll | bitbucket > >This will work only so long as the process generating the output doesn't >generate enough data to fill a pipe buffer. Since your "null" program >isn't actually going to read anything, when the pipe fills, the writing >program will block. Small nit. As you said, there is a problem with the pipe buffer filling and the write hanging. More serious though is the problem that when bitbucket runs and dies, any subsequent write by ll will result in ll receiving a SIGPIPE (write to a pipe with no reader) signal and presumably being killed. -- Dave Eisen Home: (415) 323-9757 dkeisen@Gang-of-Four.Stanford.EDU Office: (415) 967-5644 1447 N. Shoreline Blvd. Mountain View, CA 94043
Re: pipe equivalent to /dev/null ???
Author: Robert E. Stampfli
Date: Sun, 16 Sep 1990 03:10
Date: Sun, 16 Sep 1990 03:10
21 lines
1536 bytes
1536 bytes
> >>Is there an equivalent 'pipe' like entity to /dev/null ? > > > >I've seen responses of > > anycommand | true > > I've been following this thread for some time, and I have > to say that neither '... | true' nor '... | :' will do the trick. > 'true' and ':' don't read their stdin, thus the process feeding them > would block and never run. Several people have commented to this effect, but it is normally not true that this sequence would block, at least not for long. Rather, "true" would execute and exit, and "anycommand" would then receive the broken pipe signal. Usually this would cause it to terminate. The net result, however, is that, although the sequence might appear to work, "anycommand" would terminate abnormally and could not be guaranteed to do any side effects which it might be expected to have done, say, after processing all of its data. -- Rob Stampfli / att.com!stampfli (uucp@work) / kd8wk@w8cqk (packet radio) 614-864-9377 / osu-cis.cis.ohio-state.edu!kd8wk!res (uucp@home)
Re: pipe equivalent to /dev/null ???
Author: Chris Torek
Date: Sun, 16 Sep 1990 16:09
Date: Sun, 16 Sep 1990 16:09
30 lines
1902 bytes
1902 bytes
In article <13731@ulysses.att.com> cjc@ulysses.att.com (Chris Calabrese) writes: >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. This much is correct, but: >'true' and ':' don't read their stdin, thus the process feeding them >would block and never run. ... several people have made this claim, and I cannot understand why. Since this is going on in comp.unix.shell, and all the examples are using shells, we can assume that the pipe is properly set up, i.e., the process writing on it does not have it open for reading as well. Since `true' and `:' exit as soon as they are run, when the first process first tries to write on the pipe it will get an error and a SIGPIPE signal. >A slightly better approach than '... | cat > /dev/null' is a trivial >program which reads its input and creates no output. Why is this better? It saves one system call per pipe-read, but other than that it takes more work and a separate program. Writing to /dev/null is very efficient (there are no user-to-kernel copies involved; indeed, you can pass illegal addresses to write() if and only if you are writing to /dev/null). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris
Re: pipe equivalent to /dev/null ???
Author: Oscar Herrera
Date: Mon, 17 Sep 1990 15:13
Date: Mon, 17 Sep 1990 15:13
20 lines
1057 bytes
1057 bytes
|.................................................... Writing to /dev/null |is very efficient (there are no user-to-kernel copies involved; indeed, |you can pass illegal addresses to write() if and only if you are writing |to /dev/null). |-- Yes, writing to /dev/null is darn efficient. Try the following (Bourne) and watch the idle time parameter in monitor go to zero while true do ps -ef >/dev/null done BTW, in case you are still wondering why I needed the a pipe equivalent to /dev/null, it was so that in RMBUX ( Rocky Mountain BASIC under HPUX ) I could construct the following statement: 1000 PRINTER IS "| cat >/dev/null"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads