views:

34

answers:

1

Hi ..When I run this command netstat -t 1 -i 2>&1 > $NETStat_OUT_FILE & inside a script , the output of netstat does not get redirected to the file.. Could any one find a solution for this ?

A: 

You need to redirect stdout first, then stderr.

netstat -t 1 -i > $NETStat_OUT_FILE 2>&1 &
Dennis Williamson
sorry.. there is no problem as such..but when i try to read the output file immediately after execution it puts out a blank file.. the redirection program takes time to write the output onto the output file..i'm able to view the output if i open it after sometime
Sharat Chandra
@Sharat: What is the time taken by command to give output if you are not redirecting it?
Space
it is instantaneous ,if you are not redirecting
Sharat Chandra