NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/52687: can't suppress warnings from /bin/sh



The following reply was made to PR bin/52687; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
	coypu%sdf.org@localhost
Cc: 
Subject: Re: bin/52687: can't suppress warnings from /bin/sh
Date: Wed, 1 Nov 2017 09:02:50 -0400

 On Nov 1, 12:15pm, coypu%sdf.org@localhost (coypu%sdf.org@localhost) wrote:
 -- Subject: Re: bin/52687: can't suppress warnings from /bin/sh
 
 |  I was hinted at this, which works:
 |  (nonexistent) 2>/dev/null
 |  
 |  And I am redirecting nonexistent's stderr.
 
 This is by design; 
 
     nonexistent 2> /dev/null
 
 Means redirect file descriptor 2 of the child process.  The shell
 tries to execute the child process (after redirection is done),
 fails and prints the error message. You need to redirect fd 2 of
 the shell. To do this you either need to capture fd 2 of another
 shell (the subshell solution above) or:
 
     $ exec 3>&2 2> /dev/null
     nonexistent
     exec 2>&3
     $
 
 christos
 


Home | Main Index | Thread Index | Old Index