Linux shell redirect

In some situation, that we need to hide the output information of a
application, such goagent or some useful manual scripts.Thus redirect into a
blackhole is the best choice you can make.
Here I will introduce the representation of streams in linux bash programming:

  • 0 :STDIN
  • 1 :STDOUT
  • 2 :STDERR

upon which we could use that number to redirect data or information into
another stream.
Here is our example:

1
$CommandThatProduceOutputs 1>/dev/null 2>&1

As we could see that,through >, we could redirect the number represented
stream into another place.
If you want to redirect one stream into another stream, using & to represent.


Linux shell redirect
https://rug.al/2013/2013-07-29-linux-shell-redirect/
Author
Rugal Bernstein
Posted on
July 29, 2013
Licensed under