This is the mail archive of the
mailing list for the Cygwin project.
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
- Date: Fri, 22 Jan 2016 16:04:37 -0800
- Subject: Re: Using Perl on Cygwin; how to prevent display of unwanted usage/error message?
- Authentication-results: sourceware.org; auth=none
- References: <CADex0xzfB3=aBJ7AgbTJ0hQKpmD0JSnX6xcjmu4fmqy284j5jw at mail dot gmail dot com> <CACoZoo3HLq1Zdfstta6_yK6-buy2Sp2GfaMmjp8Ec23bsbcuvA at mail dot gmail dot com>
> On Fri, Jan 22, 2016 at 6:21 PM, Kenneth Wolcott
> <email@example.com> wrote:
>> 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."
>> "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
>> 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?
>> Ken Wolcott
On Fri, Jan 22, 2016 at 3:34 PM, Erik Soderquist
> 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
Thank you! ">/dev/null 2>&1" solved the problem of hiding the
information I did not want displayed.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple