zsh-users
 help / color / mirror / code / Atom feed
From: William Park <opengeometry@yahoo.ca>
To: zsh-users@sunsite.dk
Subject: Re: (feature request) Shell script within shell script
Date: Fri, 7 Feb 2003 15:23:24 -0500	[thread overview]
Message-ID: <20030207202324.GA31158@node1.opengeometry.net> (raw)
In-Reply-To: <1030204091832.ZM15610@candle.brasslantern.com>

On Tue, Feb 04, 2003 at 09:18:32AM +0000, Bart Schaefer wrote:
> On Feb 3,  6:15pm, William Park wrote:
> }
> } I've finally managed to find a solution.  It's called "process
> } substitution":
> }     function test1 () {
> } 	awk -f <( cat <<"EOF"
> } 	    ...
> } 	    ...
> } 	EOF
> } 	)
> }     }
> 
> Just watch out for what happens if you ever have unbalanced
> parentheses in the content of the here-document.

A classic solution:

    function test1 () {
    exec 10<<"EOF"
    ...
    ...
    EOF
	awk -f /dev/fd/10
    exec 10<&-
    }

I didn't have to patch anything.  I just have to keep track of fd's
instead of external files.  If the here-documents don't change, then I
can put 'exec' outside the function.
-- 
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution for data management and processing. 


  parent reply	other threads:[~2003-02-07 20:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030128042243.GA3888@node1.opengeometry.net>
     [not found] ` <20030128104034.GA6470@node1.opengeometry.net>
     [not found]   ` <20030131204945.GA1189@node1.opengeometry.net>
2003-02-01  7:36     ` William Park
2003-02-01 15:48       ` Clifford Caoile
2003-02-01 16:56         ` Will Yardley
2003-02-01 17:58           ` Clifford Caoile
2003-02-01 17:04         ` William Park
2003-02-01 19:29       ` Bart Schaefer
2003-02-03 10:31         ` Peter Stephenson
2003-02-03 23:15       ` William Park
2003-02-04  9:18         ` Bart Schaefer
2003-02-04  9:28           ` William Park
2003-02-04 17:24             ` Bart Schaefer
2003-02-04 17:39               ` William Park
2003-02-07 20:23           ` William Park [this message]
2003-02-08  2:31             ` Bart Schaefer
2003-02-08 19:37               ` William Park

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=20030207202324.GA31158@node1.opengeometry.net \
    --to=opengeometry@yahoo.ca \
    --cc=zsh-users@sunsite.dk \
    /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).