i am making a command line interpreter for an os course. the preoblem statement says that i have to log the output of every command i type in this interpreter along with the usual display in the stdout. how do i do this? i have used dup2 to redirect the output to the log file, but then i cannot get the output on the screen. also i dont want to execute the command twice so that i can output to the stdout once and next time to the file. this is because outputs of some commands(eg. ps) do not remain same.. PLZ help as quickly as possible..