when i write bash the output appear on th screen ....i don't want to display the command and the command output on screen how i can do it ?
Asked
Active
Viewed 1,391 times
2 Answers
2
somecommand &> /dev/null

Ignacio Vazquez-Abrams
- 45,939
- 6
- 79
- 84
-
thank you it is work ... but if you know how i can do this on windows CMD – Mohammad AL-Rawabdeh Oct 05 '10 at 07:48
-
`somecommand > NUL`, I think. – Ignacio Vazquez-Abrams Oct 05 '10 at 07:50
-
i try it but it is effect on the exit code (return value of the batch in windows) – Mohammad AL-Rawabdeh Oct 05 '10 at 08:03
-
@Osama: If you want to dump `stderr` as well as `stdout`, use something like `somecommand > NUL 2>&1` -- This will redirect console output but the command will still populate `%ERRORLEVEL%` with exit code. – jscott Oct 05 '10 at 09:28
-
@jscott: When was FD redirection added to cmd.exe? – Ignacio Vazquez-Abrams Oct 05 '10 at 09:34
-
@Ignacio: Good question, I don't know exactly when `cmd.exe` started supporting this. I found [this page](http://support.microsoft.com/kb/110930) indicating support in NT 3.1. – jscott Oct 05 '10 at 09:44
-
Huh. Wonder why I never noticed it then. – Ignacio Vazquez-Abrams Oct 05 '10 at 09:56
0
In windows, you can use NUL
as in:
somecommand > NUL
(Please change the tags to reflect that this is actually a Windows, not unix/bash question)

yshalbar
- 103
- 3