This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-05-04 18:18:41

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Anyone good with *nix? I need some assistance.

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:

Code:

./program > file.txt &

Code:

./program & > file.txt

Or what?


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#2 2012-05-05 03:27:20

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: Anyone good with *nix? I need some assistance.

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.  smile

PS: "program" is an executable file in the current directory, right?

Last edited by blob8108 (2012-05-05 06:18:18)


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#3 2012-05-05 05:15:38

logiblocs
Scratcher
Registered: 2010-05-05
Posts: 100+

Re: Anyone good with *nix? I need some assistance.

+1

Offline

 

#4 2012-05-05 06:27:03

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Anyone good with *nix? I need some assistance.

Alright. thanks.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

Board footer