- 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...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
NOTE: unbound is now available via epel repo on Amazon Linux install requirements yum groupinstall "Development Tools" yum i...
No comments:
Post a Comment
Note: only a member of this blog may post a comment.