Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (feature request) Shell script within shell script
- X-seq: zsh-users 5866
- From: William Park <opengeometry@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: (feature request) Shell script within shell script
- Date: Mon, 3 Feb 2003 18:15:18 -0500
- In-reply-to: <20030201073655.GA3893@xxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030128042243.GA3888@xxxxxxxxxxxxxxxxxxxxxx> <20030128104034.GA6470@xxxxxxxxxxxxxxxxxxxxxx> <20030131204945.GA1189@xxxxxxxxxxxxxxxxxxxxxx> <20030201073655.GA3893@xxxxxxxxxxxxxxxxxxxxxx>
On Sat, Feb 01, 2003 at 02:36:55AM -0500, William Park wrote:
> Dear Zsh expert,
>
> When writing a shell script, quite often, I have to write bunch of
> separate Awk/Python/Perl/etc scripts that are more than few lines. I
> tend to lose track of which script does what, and get bitten over two
> levels of quotes.
>
> Essentially, I wish I could do something like
>
> herefile test1 << "EOF"
> #! /usr/bin/gawk -f
> ...
> ...
> EOF
>
> and
>
> herefile test2 << "EOF"
> #! /usr/bin/python
> ...
> ...
> EOF
>
> so that invocation and usage of 'test1' and 'test2' will be the same as
> if they were separate real files.
>
> Can Zsh do this now? If not, does Zsh have standard mechanism to
> provide this kind of extensions?
I've finally managed to find a solution. It's called "process
substitution":
function test1 () {
awk -f <( cat <<"EOF"
...
...
EOF
)
}
and
function test2 () {
python <( cat <<"EOF"
...
...
EOF
)
}
--
William Park, Open Geometry Consulting, <opengeometry@xxxxxxxx>
Linux solution for data management and processing.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author