in reply to Disable output from system

In addition to what already has been said, here other variations:

qx(tar ...); # Burns more CPU cycles, but who cares ;-) use File::Spec::Functions qw(devnull); system('tar .... >'.devnull.' 1>&2'); # works on *nix and windoze

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: Disable output from system
by Anonymous Monk on Mar 26, 2009 at 10:57 UTC
    Hi, Roland. You wrote: system('tar .... >'.devnull.' 1>&2'); # works on *nix and windoze As I can see you redirect STDOUT to devnull and then again you redirect STDOUT to STDERR... Is this correct? I think it is typo, isn't it?
      you redirect STDOUT to devnull and then again you redirect STDOUT to STDERR... Is this correct?

      Sorry, a typo indeed. Of course you have to do something like

      '....>'.devnull.' 2>&1'
      and not "1>&2". I mistakingly exchanged 2 and 1. My point was that you have to redirect *first* to devnull, and *then* do the 2>&1, not the other way around.

      -- 
      Ronald Fischer <ynnor@mm.st>
Re^2: Disable output from system
by Tumata (Initiate) on Mar 26, 2009 at 10:59 UTC
    Hi, Roland. You wrote: system('tar .... >'.devnull.' 1>&2'); # works on *nix and windoze As I can see you redirect STDOUT to devnull and then again you redirect STDOUT to STDERR... Is this correct? I think it is typo, isn't it ?