Differences

This shows you the differences between two versions of the page.

Link to this comparison view

internal:shell [2008/05/14 18:08]
grg added URL to csh-whynot
internal:shell [2008/05/22 20:11] (current)
solar made the headings consistent with those on other pages, made the description easier to understand (hopefully)
Line 1: Line 1:
-=== SHELL TRICKS ​===+====== Shell tricks ======
  
-=== How to redirect stderr but not stdout to a pipe ===+===== How to redirect stderr but not stdout to a pipe =====
  
 (taken from [[http://​www.faqs.org/​faqs/​unix-faq/​shell/​csh-whynot/​|csh-whynot]]) (taken from [[http://​www.faqs.org/​faqs/​unix-faq/​shell/​csh-whynot/​|csh-whynot]])
- 
  
   exec 3>&​1;​ grep yyy xxx 2>&1 1>&3 3>&- | sed s/​file/​foobar/​ 1>&2 3>&-   exec 3>&​1;​ grep yyy xxx 2>&1 1>&3 3>&- | sed s/​file/​foobar/​ 1>&2 3>&-
   grep: xxx: No such foobar or directory   grep: xxx: No such foobar or directory
  
-Normal ​output ​would be unaffected. ​ The closes there were in case +grep's normal ​output ​(on stdout) will be unaffected. ​We're closing fd 3 in case a program actually cares about this fd (although most programs don't). We send stderr to sed's stdin, and then put sed's stdout "back" to stderr.
-something really cared about all its FDs We send stderr to sed, +
-and then put it back out 2.+
internal/shell.txt · Last modified: 2008/05/22 20:11 by solar
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate to DokuWiki Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Powered by OpenVZ Powered by Openwall GNU/*/Linux