Difference between revisions of "/dev/stderr"

From wikieduonline
Jump to navigation Jump to search
(Created page with "{{Draft}}")
 
m (Welcome moved page Stderr to /dev/stderr)
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Draft}}
+
{{lowercase}}
 +
[[wikipedia:stderr]]
 +
 
 +
* <code>2>[[&1]]</code>
 +
* <code>&></code>
 +
 
 +
* <code>[[sudo]] -S</code> or <code>[[sudo]] --stdin</code>
 +
 
 +
* <code>2>[[/dev/null]]</code>
 +
 
 +
 
 +
your-command-with-stdout-and-stderr 2>&1 | [[tee -a]] your file
 +
 
 +
 
 +
 
 +
 
 +
* [[Google style guide]]: https://google.github.io/styleguide/shellguide.html#stdout-vs-stderr
 +
err() {
 +
  echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
 +
}
 +
 +
if ! do_something; then
 +
  [[err]] "Unable to do_something"
 +
  exit 1
 +
fi
 +
 
 +
 
 +
== Related ==
 +
* [[CKA: Manage container stdout & stderr logs]]
 +
* <code>[[gcloud]]</code>
 +
* [[tee -a]]
 +
 
 +
== See also ==
 +
* {{stdin}}
 +
* {{logging}}
 +
* {{shell}}
 +
 
 +
 
 +
[[Category:Linux]]

Latest revision as of 11:37, 15 February 2024

Advertising: