zsh-workers
 help / color / mirror / code / Atom feed
From: ZyX <zyx.vim@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: Tee all output to log file?
Date: Wed, 2 Feb 2011 08:04:28 +0300	[thread overview]
Message-ID: <201102020804.29094@-zyx> (raw)
In-Reply-To: <alpine.LNX.2.01.1102011836170.2792@hp>

[-- Attachment #1: Type: Text/Plain, Size: 1298 bytes --]

Reply to message «Tee all output to log file?», 
sent 02:41:26 02 February 2011, Wednesday
by Benjamin R. Haskell:

> Is there something straightforward that I'm overlooking?  Is there a
> commonly used utility for this?  (`script` comes to mind, but I recall
> klunkiness when trying it in the past.)
If you don't like script, maybe you should try screen:

    (( $+logfile )) && \
        exec screen -L -c =(echo "logfile $logfile") -m -S script-$0 $0 $@

(probably needs some escaping of $logfile).

Does anybody know, why it does not work when I start screen in detached mode?

Original message:
> For scripting purposes I occasionally want a way to both record and
> display all the output of a script.  On several occasions now, I've
> looked through the output redirection section of the manual, but I never
> come up with quite what I'm looking for.
> 
> Essentially, when I want this, I usually want something like:
> 
> #!/bin/zsh
> (( $+logfile )) && exec |& tee $logfile
> 
> Boiled down even further, it's really just this I'm looking for:
> exec |& tee logfile
> 
> Is there something straightforward that I'm overlooking?  Is there a
> commonly used utility for this?  (`script` comes to mind, but I recall
> klunkiness when trying it in the past.)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

       reply	other threads:[~2011-02-02  5:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LNX.2.01.1102011836170.2792@hp>
2011-02-02  5:04 ` ZyX [this message]
2011-02-02 17:28   ` Benjamin R. Haskell
2011-02-02 18:05     ` ZyX
2011-02-02 18:13       ` Benjamin R. Haskell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201102020804.29094@-zyx \
    --to=zyx.vim@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).