I have a program (let's call it ./program) I need to take the programs output and redirect it to a file, but I also need to create a new thread/job/process for my program.
Would I use:
./program > file.txt &
./program & > file.txt
Or what?
Offline
bobbybee wrote:
I have a program (let's call it ./program) I need to take the programs output and redirect it to a file
You want to redirect stdout to a file? I think that's "./program > file.txt" as you did.
but I also need to create a new thread/job/process for my program.
Are you trying to run the process in the background on the current terminal? If so, I think that's "./program &". This will be killed when you exit/kill the current terminal process, though.
So yeah: I'd have thought "./program > file.txt &" would do it.
If you want it to survive bash/your terminal dying, you may want to look at something like the screen command.
PS: "program" is an executable file in the current directory, right?
Last edited by blob8108 (2012-05-05 06:18:18)
Offline
Offline
Alright. thanks.
Offline