Pipe std error to null
Shou Ya Shou Ya 2, 1 1 gold badge 20 20 silver badges 42 42 bronze badges. Did you try. Well I need to relearn some shell. Add a comment. Active Oldest Votes. You want. Improve this answer. Greg Dubicki 4, 2 2 gold badges 46 46 silver badges 59 59 bronze badges. In my edit comment I incorrectly referenced stdin instead of stdout though the edit itself is still correct.
I could not see how to fix edit comment or comment on edit review so mentioning here. Thanks — Manohar Reddy Poreddy. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks.
Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked 2. Related Hot Network Questions. They will be marginally less efficient unless the shell treats them as special cases; the pure numeric notation doesn't involve accessing files by name, but using the devices does mean a file name lookup. Whether you could measure that is debatable. I like the succinctness of the numeric notation - but I've been using it for so long more than a quarter century; ouch!
KurtPfeifle: au contraire! One must read the redirection chains from left to right since that is the way the shell processes them. Right-to-left wouldn't work. Show 24 more comments. Peter Mortensen Kramish Kramish 3, 1 1 gold badge 12 12 silver badges 2 2 bronze badges. Can we create a file descriptor that has stderr and another that has the combination of stderr and stdout?
In other words can stderr go to two different files at once? JonathanLeffler Out of curiosity, does your tweak serve any purpose performance-wise, other than perhaps clarifying the role of file descriptor 3 for an observer? In truly arcane situations, it might make the difference between a process detecting and not detecting EOF, but that requires very peculiar circumstances.
Caution : this assumes FD 3 is not already in use, doesn't close it, and doesn't undo the swapping of file descriptors 1 and 2, so you can't go on to pipe this to yet another command. See this answer for further detail and work-around. Show 8 more comments. Jonathan Leffler k gold badges silver badges bronze badges.
Rich Johnson Rich Johnson 2, 1 1 gold badge 11 11 silver badges 3 3 bronze badges. Works very well for output to the screen. Do you have any idea why the ungrepped content appears again if I redirect the grep output into a file? Otherwise the output of the "stderr pipe" will go through the "stdlog pipe". Here's a small example that may help me next time I look-up how to do this.
Consider the following That seems inconsistient to me. Show 1 more comment. Pinko Pinko 3, 2 2 gold badges 18 18 silver badges 15 15 bronze badges. No, without that, the filtered stderr ends up being routed to stdout. The redirections are however not technically "part of the standard input" of xargs. The standard input of xargs comes from the sudo command on the left hand side of the pipe. Depending on whether this is a "once-liner" throwaway command that you'll never use again, or a line of code that will go into a system-critical maintenance script, you may want to craft the left-hand side of your pipeline in such a way that it does not produce diagnostic messages at all under normal operating circumstances and hence does not need to have its error messages hidden.
Alternatively, you may want to manage the service running on port through systemd or some equivalent service framework. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Asked 6 months ago.
Active 6 months ago.
0コメント