From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 254 invoked by alias); 2 Feb 2011 18:06:05 -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: 28692 Received: (qmail 5893 invoked from network); 2 Feb 2011 18:05:53 -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=cfjm8BL6aY5a/vHkLDivPGel+rVM9tvePZH4fWNlez8=; b=cXbwODOISakZQLqy1a8T3et/mdkOou+WHLJjCeDnLafSNK1hyVamFRjDRz/swXhAJ+ 6fHKmlBawcJpaUUJP2FpoGwJq/GEreFhQixifx2qeI09UopfBBkSfwsFIhKALPpqqK2p goqj1snRvBOWk0dOqClWxZgDRPVpu8h8MALH4= 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=gwtvHeYkbSPHFxJi6TtuulJn73HKKmObyN8xGFlvjPcbkYnNsjInO2vYnT8wfhlDF3 B4ylrv4X8itTvvpIDJw9z9rUASMHsVXCiYVoP+w1pi7kYXW+bBML235zp1f4SuftR7hu HAg7hg/UDdphvJ607ksLR19iRvJZCfn/y3eVg= 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 21:05:41 +0300 User-Agent: KMail/1.13.5 (Linux/2.6.36-zen1; KDE/4.5.5; x86_64; ; ) References: <201102020804.29094@-zyx> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2606413.pmTPMV7BWA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201102022105.41927@-zyx> --nextPart2606413.pmTPMV7BWA Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reply to message =C2=ABRe: Tee all output to log file?=C2=BB,=20 sent 20:28:13 02 February 2011, Wednesday by Benjamin R. Haskell: > && exec env doinglogging=3Dtrue ... I used to write this as =C2=ABdoinglogging=3Dtrue exec ...=C2=BB or with doinglogging=3Dtrue exec ... Any reason why env command should envoked here I am not aware of? Original message: > On Wed, 2 Feb 2011, ZyX wrote: > > Reply to message =C2=ABTee all output to log file?=C2=BB, > > sent 02:41:26 02 February 2011, Wednesday > >=20 > > 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.) > >=20 > > If you don't like script, maybe you should try screen: > > (( $+logfile )) && \ > > =20 > > exec screen -L -c =3D(echo "logfile $logfile") -m -S script-$0 $= 0 $@ >=20 > I find `screen` even more annoying than `script` for scripting purposes, > wonderful though it is for interactive use. >=20 > I really just want the redirection, not the many extra features that > `screen` adds. >=20 > Adding >=20 > > Does anybody know, why it does not work when I start screen in detached > > mode? >=20 > Cf. above annoyance. For doing something with Vim under Apache (using >=20 > :TOhtml), I recently resorted to this hackery: > screen -q -d -m -S $sessionname vim -u NONE -N +'so $scriptname' > (Then, loop, waiting for one of: > 1: the Vim script to touch a marker file that indicated completion > 2: a specified timeout, in case something errored out, preventing a > clean Vim exit > ) > screen -X -S $sessionname quit >=20 >=20 >=20 > Despite my annoyance (I'm easily annoyed), I tried your above > suggestion. It didn't capture stderr, so I added a flag that logging > was in progress and added a redirect for it (also added '-q' to the > `screen` commands): >=20 > (( $+logfile && ! $+doinglogging )) \ > && exec env doinglogging=3Dtrue screen -L -c =3D(echo "logfile $logfi= le") > -q -m -S script-$0 $0 $@ (( $+doinglogging )) && exec 2>&1 >=20 > Seems okay for what I'm doing. >=20 > Thanks, > Ben --nextPart2606413.pmTPMV7BWA 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) iEYEABECAAYFAk1JnPUACgkQkOgHluiXxU9xzgCdEcZv6+8HpdBR5rrjyzm7i8Rq Y/MAn3UNKC0fs+wfPIgKz/9yzQT7N3r+ =q3Of -----END PGP SIGNATURE----- --nextPart2606413.pmTPMV7BWA--