You can accomplish it redirecting the output of bc
to /dev/null
:
$ bc &>/dev/null <<END
1+1
quit
END
Note that using & > /dev/null
both stdout and stderr will be sent to /dev/null
, so not output will appear at all.
Pregunta
I want to insert commands into an interactive environment using the following method:
bc <<END
1+1
quit
END
The output of the example is '2
' and it appears after typing END
. Suppose I would want to suppress this output. So after typing END I don't want any output to appear. How could I accomplish this?
Solución
You can accomplish it redirecting the output of bc
to /dev/null
:
$ bc &>/dev/null <<END
1+1
quit
END
Note that using & > /dev/null
both stdout and stderr will be sent to /dev/null
, so not output will appear at all.