[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash variable interpolation
From: |
Peng Yu |
Subject: |
Re: [Help-bash] bash variable interpolation |
Date: |
Fri, 20 Mar 2015 21:39:24 -0500 |
On Fri, Mar 20, 2015 at 7:20 AM, Greg Wooledge <address@hidden> wrote:
> On Thu, Mar 19, 2015 at 06:37:30PM -0500, Peng Yu wrote:
>> The real problem is that I want to replace some bash variables in a
>> file and then print the output.
>
> http://mywiki.wooledge.org/TemplateFiles
The problem is that the variable must be exported to be usable. Is
there a way to somehow use the current shell?
~$ cat template.txt
$x $y
~$ cat main.sh
#!/usr/bin/env bash
export x=abc
export y=xyz
{
echo "cat <<EOF"
cat template.txt
echo "EOF"
} | bash
~$ ./main.sh
abc xyz
--
Regards,
Peng
- Re: [Help-bash] bash variable interpolation, (continued)
- Re: [Help-bash] bash variable interpolation, Eduardo A . Bustamante López, 2015/03/19
- Re: [Help-bash] bash variable interpolation, Peng Yu, 2015/03/19
- Re: [Help-bash] bash variable interpolation, Eduardo A . Bustamante López, 2015/03/19
- Re: [Help-bash] bash variable interpolation, Greg Wooledge, 2015/03/20
- Re: [Help-bash] bash variable interpolation,
Peng Yu <=
- Re: [Help-bash] bash variable interpolation, Dan Douglas, 2015/03/21