- myCLIapp > /dev/null 2>&1
 - Order is important, don't reverse the redirects
 - See below
 - First redirect sends STDOUT to kernel's blackhole equivalent
 - result: STDOUT is forgotten, never shown
 - STDOUT is implied when no number before '>'
 - Second redirect sends STDERR to where STDOUT points
 - STDERR goes where STDOUT goes
 - So STDERR ends up in blackhole too
 - The amphersand is necessary
 - to specify this is a "file handle"
 - and not a filename
 - Reverse mistake
 - myCLIapp 2>&1 > /dev/null
 - Read left to right
 - 2>&1
 - Would 1st send STDERR to where STDOUT is pointing currently
 - Which is STDOUT so far
 - > /dev/null
 - STDOUT is implied since no number before '>'
 - Send STDOUT to /dev/null
 - Result is
 - STDERR being displayed
 - STDOUT being sent to blackhole
 - Remember
 - if no number given before '>', them implied is STDOUT
 
Thursday, 10 January 2013
Redirection on CLI: greater-thans, ampersands and numbers
Subscribe to:
Post Comments (Atom)
Interview questions: 2020-12
Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer Networking Layer 1 vs Layer 4 haproxy u...
- 
CRITICAL: AWS now offers internal VPC DNS! Below is no longer necessary AFAIK. Woo hoo! http://aws.amazon.com/about-aws/whats-new/2014/...
 - 
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
 - 
Status -> System logs -> Settings Make sure Log packets blocked by the default rule is not checked Check Show log entries in re...
 
No comments:
Post a Comment
Note: only a member of this blog may post a comment.