Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

2 Answers 2

up vote 2 down vote accepted
somecommand &> /dev/null
share|improve this answer
    
thank you it is work ... but if you know how i can do this on windows CMD –  Mohammad AL-Rawabdeh Oct 5 '10 at 7:48
    
somecommand > NUL, I think. –  Ignacio Vazquez-Abrams Oct 5 '10 at 7:50
    
i try it but it is effect on the exit code (return value of the batch in windows) –  Mohammad AL-Rawabdeh Oct 5 '10 at 8: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 5 '10 at 9:28
    
@jscott: When was FD redirection added to cmd.exe? –  Ignacio Vazquez-Abrams Oct 5 '10 at 9:34

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.