Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Redirecting stdout and/or stderr after the fact
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
dmohs
n00b
n00b


Joined: 09 Dec 2002
Posts: 13
Location: Livermore, CA

PostPosted: Sun May 04, 2003 4:34 am    Post subject: Redirecting stdout and/or stderr after the fact Reply with quote

I understand how to redirect stdout and stderr from the command line when I execute something. However, I am occasionally in the position where I begin executing a long command and I would like to redirect output AFTER that execution has begun.

Can you tell me if this is possible at all and, if so, how I would go about doing it? I'm generally a bash user.

Thanks.
Back to top
View user's profile Send private message
kopfarzt
Apprentice
Apprentice


Joined: 05 Apr 2003
Posts: 170
Location: Vienna, Austria

PostPosted: Sun May 04, 2003 11:05 am    Post subject: Reply with quote

I doubt that it is possible, at least I don't know how.

Depending on the reason for your question, you might be interested in "screen". I always use it for longer builds, because you can "detach" (CtrlA-CtrlD) it, open a log file at any time (CtrlA-H) and watch your detached session from different locations (home/work, screen -r -d).

Another way is to redirect output from the beginning and attach to the logfile with tail -f at any time you want to check "live".

Not really what you asked for, I know...

kopfarzt
Back to top
View user's profile Send private message
credmp
Apprentice
Apprentice


Joined: 02 Jul 2002
Posts: 207
Location: Netherlands

PostPosted: Sun May 04, 2003 6:31 pm    Post subject: Reply with quote

kopfarzt wrote:
Another way is to redirect output from the beginning and attach to the logfile with tail -f at any time you want to check "live".


And yet another way is to use tee for this....
Code:
command --verbose | tee file
this will write the output to the file 'file' plus it will display the output on the screen...

regards
Back to top
View user's profile Send private message
dmohs
n00b
n00b


Joined: 09 Dec 2002
Posts: 13
Location: Livermore, CA

PostPosted: Sun May 04, 2003 6:41 pm    Post subject: Forethought required Reply with quote

I talked with a friend of mine also and I do believe that you are correct - redirection must occur when the command is executed. It cannot be "attached" afterward.

I actually used the "tail -f" method on a different ebuild. I really like this one because when I exit tail, I don't get screen output - which can slow things down a bit on verbose commands.

Thanks for your replies.

-dm
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum