I have tried various combinations of gedit
, &
, >/dev/null 2>/dev/null
. When gedit
is used with the other two it always prints something to the terminal.
I understand that the numbers are pid's. But, please elucidate the following
- Why are those outputs produced when I redirected stdout and stderr to /dev/null, whereas bare
gedit
does print nothing? - What does
[1]+ Done
mean? - How to prevent those outputs?
Best Answer
The
[1] 24446
and[1]+ Done ...
are printed by the shell. Fromman bash
:You can disable the
Done
output by disabling monitor mode:You cannot disable the first form in an interactive shell, however. Instead, try running in a subshell:
if you use this, the background process is no longer under job control of the shell.
One a side note,
&>
can be used to redirect both stdout and stderr together.