delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/22/19:04:55

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=Lt
TI3f4hpzntEnb64BsI7DwyQd1FdvygnL/0hCoKlw6WS+hmQf+ebj+bBaimjWJ7sf
asL/GlwBNcuNtyx+5IWO7vLkYTxHNRrtmSSzkcVKdA7lRxdNaNPXvuTpJ2tgtG/v
R6UxioQGmf4UQECyPJmMk1qMKWIrh4Hg3kEG/3B6w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=vJ8Sk2DL
l+0m717a2tRygx7ZAxA=; b=bQIwK07TfL3kiTkUMUBTZRndHI8diQw1fXkRr/DJ
9OOPjA/KiZqsnhXg6BTupsOFfJI9/gNJYHzu3eT2LU3NNyCnByj7NzoHWqIgNRwN
nG9iKKkYGyeTH/rkqRbzn/rZk1J9Mw5CArNtqE9W4yagrPLVuvqOmTv45BbHaB5Y
oo8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=kennethwolcott AT gmail DOT com, kennethwolcottgmailcom, H*i:sk:CACoZoo, H*f:sk:CACoZoo
X-HELO: mail-yk0-f180.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=5R46iFedMsOIFJyq7mmg0/Tq6/qnNFZZe4PXxoQJcWk=; b=YlpXRK5sRLe88zo6uC25yrHRlYC3+Agm4VFPeSam7F8kOHyOj48T9MJcI5o3fX61wI QxHDULcSntcZ4KsH2B5MV//n8yWEI4ccibIh4c6kMvBTelcgt5nj+NsqI3INZdVPgZt9 AkQzRB6OzVdwBD57BoX5/HDBnhzzAYcHGWJ03V4HgrLu1OH7eD80bVreJ59HwQz3MNWb wty0PELJkUidJALjYBdqOuQOOvuw9NGuKJyeZC1bZMk4am+n2tB18hltIRVlQ/+ZpdWI rx7lLqSMau3MCZsan84FnShjEYrx61ViHSbYNjv9xnlVg0njLnEDdAYq5ck1b0TK/zsn I5yg==
X-Gm-Message-State: AG10YORODwjEnnvX6n+Z8p1DrdrWljivt/D5yJ/V6OL20V8QfP8Rrs5MbKTg1a0j+nR94/+pFN32PdzXiGhKCQ==
MIME-Version: 1.0
X-Received: by 10.37.33.84 with SMTP id h81mr3213503ybh.166.1453507477641; Fri, 22 Jan 2016 16:04:37 -0800 (PST)
In-Reply-To: <CACoZoo3HLq1Zdfstta6_yK6-buy2Sp2GfaMmjp8Ec23bsbcuvA@mail.gmail.com>
References: <CADex0xzfB3=aBJ7AgbTJ0hQKpmD0JSnX6xcjmu4fmqy284j5jw AT mail DOT gmail DOT com> <CACoZoo3HLq1Zdfstta6_yK6-buy2Sp2GfaMmjp8Ec23bsbcuvA AT mail DOT gmail DOT com>
Date: Fri, 22 Jan 2016 16:04:37 -0800
Message-ID: <CADex0xy67O2u6niBTN2=0Eq5xa_CYHgr58AzMHMLxi3LjT2NBA@mail.gmail.com>
Subject: Re: Using Perl on Cygwin; how to prevent display of unwanted usage/error message?
From: Kenneth Wolcott <kennethwolcott AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

> On Fri, Jan 22, 2016 at 6:21 PM, Kenneth Wolcott
> <kennethwolcott AT gmail DOT com> wrote:
>> Hi;
>>
>>   I'm using a qx call to "net user username /DOMAIN" (probably should
>> use system instead) to determine whether a person having an active
>> account in an application is still an employee.
>>
>>   I get two messages back (error and/or usage) when a username is not found.
>>
>> "The user name could not be found."
>>
>> and
>>
>> "More help is available by typing NET HELPMSG 2221."
>>
>> I'd like to hide (not display, not print) these two messages.
>>
>> Coming from a UNIX/Linux background, I'd do a "2>&1 > /dev/null"
>> operation to dispose of STDOUT and STDERR, but "1<&2 > NUL" (suggested
>> by
>>
>> "https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true"
>>
>> does not seem to work.
>>
>>   I tried file descriptor 3, but that resulted in an error regarding
>> unsupported file handle,. or something like that.
>>
>>   I was considering using IPC::Run3, but I don't think that will help
>> with suppressing error message and usage message.
>>
>> Perhaps there is a Perl module that is native to Cygwin that will
>> perform this kind of lookup for me?  Maybe a Perl module that is NOT
>> native to Cygwin?
>>
>> Thanks,
>> Ken Wolcott
>>

On Fri, Jan 22, 2016 at 3:34 PM, Erik Soderquist
<ErikSoderquist AT gmail DOT com> wrote:
> In cygwin, I use >/dev/null 2>&1 quite frequently and it works as expected.
>
> In windows cmd.exe, I don't know why they would recommend the < part
> for dealing with output, but I have used >NUL 2>&1 for the same effect
> in Windows command shells.
>
> -- Erik

Hi Erik;

  Thank you!  ">/dev/null 2>&1" solved the problem of hiding the
information I did not want displayed.

Thanks,
Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019