Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: convolutions
- X-seq: zsh-users 20910
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: convolutions
- Date: Fri, 6 Nov 2015 21:38:07 -0800
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ImCZVz7GHiCq81mllANyVwIgTV23P2M7wWOWXyY46ns=; b=gFjCSGrwZXOXck6ds7SD7RrVKxCLmPb9iw+Mr68aEivl4n2SayMPfr0jeyB6WVmrfk Ot75qRpRXaOCthQ6SjcRE8wIVO1wx5QjqMyBN+yklHkTy4G/Q0sVwv78NiR4H0BwZ/Ej WA5JGwgOAh0Zgjz6O9lDkI0eTl3qQMwrE0zJ2SDmO0JcmDhBlGM6hkWQ087y5zsSM236 lhHvGAHplyy8juXnqAktyASo7Z2fNDKC6Zdm9fhTNs4ydLdLj7dsNSLNCHdgt6aVfb+H gDvkwieGkJWmxkCmMHWTjmKYXep/2LnAsN/79AciY2eEZLujaOWKeBYzCqEWjriZv94/ JyTA==
- In-reply-to: <563D5ED5.1070102@eastlink.ca>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <563D5ED5.1070102@eastlink.ca>
On Fri, Nov 6, 2015 at 6:15 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> Gentlemen:
>
> echo "$(eval echo "\${$(cat in_file)}")" >! out_file
>
> That's the best I've been able to do expanding color variables, eg. " ${red}
> " into their native " \e[31;1m " in a file.
Just as an aside, this is the second code example you've posted
recently that can't possibly work in practice. I can only assume
you're mis-transcribing in an attempt to simplify whatever your real
code is.
If I understand this correctly, you have a file that contains text
which looks like
The following ${fg[red]}text is red${reset_color} and this is not
and you want to end up with the variables expanded in out_file as the
actual escape sequences?
print -R "${(e)$(<in_file)}" >| out_file
Of course that will also replace other possible expansions that may
appear in the text of in_file. If you really want to replace exactly
and only the specific references to color variables, you need
something like Zyx's sed expression.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author