[mdlug] [HOWTO request] filter stderrr without altering stdout

Robert Meier eaglecoach at wwnet.com
Tue Apr 10 18:31:26 EDT 2007


Script-kiddies,

How can I write a wrapper that filters stderr (fd 2) without altering 
stdout (fd 1) using ksh?

Detail:
   ksh> func 2>/devnull
   This is desired from stdout.

   ksh> func 1>/dev/null
   This is desired from stderr
   This is undesired from stderr
   This is more desired from stderr

    ksh> func-wrapper 2>/dev/null
    This is desired from stdout

    ksh> func-wrapper 1>/dev/null
    This desired from stderr
    This is more desired from stderr

      ksh> cat func-wrapper
      #!/bin/ksh
      ????
      func $*
      ????



What should the ???? be?

TIA,
-- 
Dr. Robert J. Meier



More information about the mdlug mailing list