From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 554 invoked by alias); 2 Feb 2011 05:04:41 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28690 Received: (qmail 17234 invoked from network); 2 Feb 2011 05:04:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.161.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:reply-to:to:subject:date:user-agent :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=hU1Ay92e9GKDD9oGZipYYJ9xAUb6U02ZHGq7/hGByDI=; b=gpGjHJmXnQLEggZgLXWNV3ewIYaDm4mixx+1chMiRPmvvhjzys20AQuQUs2XXE68NQ fNpXEWk5bszZiN+YPkfPHBxkVSmk6SJZBnFeJsHZSnR9jbA3j74vkgdONGjY7vnxgSVm 8jmCzkutgpgv1L5I/4/mOhAi0WVV1y4n1zlpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=aEVuxosFxFs9532fkNm8dbTpPw3PUhuUXN+8ACXbsZcQ93NRgnh6n4I6YokHxv1ZAH bkM8uRVdIy5sqiRQsIWixINm+CvmZ4JV5wCzG5LrSzsetFms+XF9E2kCAS+o313idUp3 MgBk+/LV5dpCKPkRr6c2/fEetilck5ccLrZHk= From: ZyX Reply-To: 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 User-Agent: KMail/1.13.5 (Linux/2.6.36-zen1; KDE/4.5.5; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1565169.gxlOnvYM0f"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201102020804.29094@-zyx> --nextPart1565169.gxlOnvYM0f Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Reply to message =ABTee all output to log file?=BB,=20 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 =3D(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 mod= e? 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. >=20 > Essentially, when I want this, I usually want something like: >=20 > #!/bin/zsh > (( $+logfile )) && exec |& tee $logfile >=20 > Boiled down even further, it's really just this I'm looking for: > exec |& tee logfile >=20 > 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.) --nextPart1565169.gxlOnvYM0f Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEABECAAYFAk1I5d0ACgkQkOgHluiXxU9YqwCfTa0/xNL/0i6pVuaFt5Z5Ehij IgwAn3qiPzPU6hOnMp4t6KwGgdfUGnaK =vffH -----END PGP SIGNATURE----- --nextPart1565169.gxlOnvYM0f--