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

Carl T. Miller millerc at cantonpl.org
Tue Apr 10 20:12:26 EDT 2007


Robert Meier wrote:
> Script-kiddies,
>
> How can I write a wrapper that filters stderr (fd 2) without altering
> stdout (fd 1) using ksh?

I'm not sure I understand what you're trying to do.  It sounds
like you want a script that will call a function.  And I'm guessing
that you don't want to see any errors from the function, but not
filter errors from the script.

If that's the case, have the script send stderr for the function
to /dev/null, like this:

  ksh> cat func-wrapper
  #!/bin/ksh
  func $* 2>/dev/null

c





More information about the mdlug mailing list