From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4210 invoked from network); 3 Feb 2003 10:31:39 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 3 Feb 2003 10:31:39 -0000 Received: (qmail 14258 invoked by alias); 3 Feb 2003 10:31:00 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5862 Received: (qmail 14250 invoked from network); 3 Feb 2003 10:30:59 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 3 Feb 2003 10:30:59 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 3 Feb 2003 10:30:59 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Mon, 3 Feb 2003 10:37:16 +0000 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id DQ47KSHB; Mon, 3 Feb 2003 10:28:58 -0000 To: zsh-users@sunsite.dk Subject: Re: (feature request) Shell script within shell script In-reply-to: ""Bart Schaefer""'s message of "Sat, 01 Feb 2003 19:29:38 GMT." <1030201192938.ZM7570@candle.brasslantern.com> Date: Mon, 03 Feb 2003 10:31:00 +0000 Message-ID: <9655.1044268260@csr.com> From: Peter Stephenson "Bart Schaefer" wrote: > The tricky bit of course is that the redirection becomes the standard > input of the "herefile" function, so your script will see end-of-file > as soon as it starts running. Of course you don't necessarily need to use a here-document at all. therefile() { setopt localtraps localoptions noshwordsplit local tmp=${TMPPREFIX}HERE$$ trap "command rm -f $tmp" EXIT touch $tmp || return chmod u=rwx,go-rwx $tmp || return print -r "$1" >>$tmp || return shift $tmp "$@" } therefile \ '#!/usr/local/bin/perl print "You typed: @ARGV\n"; ' arg1 arg2 You typed: arg1 arg2 -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************