Re: bash: how to restore output to the term after exec>FILE?

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 01/24/04


Date: Sat, 24 Jan 2004 09:28:27 GMT

On Sat, 24 Jan 2004 08:17:34 +0100, nospam55 <nospa@no.yahoo.no> wrote:
>
>
> Hi.
>
> In my .bashrc script I say
>
> exec > .bash.startup.log
>
> later I want output back to the terminal , how can I get this ? Maybe kind of
>
> exec &> /dev/tty
>
> ? Will this be reliable in generic bash scripts ?
>
>
> Thanks :-)
>
>

I don't think you need that first exec.

You are wanting to empty that log file, I assume, and this will do it:

:> .bash.startup.log

What happens when you use exec, is that you replace the shell with that
program, so I guess you'd have to kill it by finding its PID and
doing a kill -9 PID.

kill -9 $$

Might do it.

(You might want to put that command in a file called .bash_logout to
run as the shell exited rather than started up.)

AC



Relevant Pages

  • Re: how to make my deamon depends on other
    ... Does this make any sense in your app that the mydaemon's pid one more ... of the log file changed back to root who is the system-starting the ... I used in mydeamon script to change the owner of log file. ...
    (comp.unix.shell)
  • Re: Best way to remove junk and ads
    ... > kill -9. ... Hmmm. ... is a dog of a site. ... running Apache, you'll get some noise in the log file, but that's no ...
    (linux.redhat)
  • Re: server bootstrapping upon connection (WARNING: LONG)
    ... >> But as described, the ps log showed two entries of fooServer.py, but in ... only one server actually was started (I can tell that ... PID, not the phenomena I saw in the ps log file (where more than one ...
    (comp.lang.python)
  • nagios
    ... The log file says that nagios has started and gives a pid. ... Any suggestions for alternate monitors? ...
    (Debian-User)
  • Re: nagios
    ... > The configuration passes the sanity test. ... > The log file says that nagios has started and gives a pid. ...
    (Debian-User)