[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash variable interpolation
From: |
Ken Irving |
Subject: |
Re: [Help-bash] bash variable interpolation |
Date: |
Thu, 19 Mar 2015 19:53:43 -0800 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Thu, Mar 19, 2015 at 08:03:01PM -0400, Dave Rutherford wrote:
> On Thu, Mar 19, 2015 at 7:37 PM, Peng Yu <address@hidden> wrote:
> > On Thu, Mar 19, 2015 at 5:42 PM, Eric Blake <address@hidden> wrote:
> >> On 03/19/2015 04:04 PM, Peng Yu wrote:
> >>> I want to interpolate variable in a bash string variable. But the
> >>> following code shows the spaces are not maintained.
> >>
> >> Insufficient quoting on your part.
> >>
> >>> There is some
> >>> built-in features in perl to do string interpolation. Does anyone know
> >>> the best way to do string interpolation in bash? Thanks.
>
> I feel dumb. What is meant by `string interpolation'?
I think I first saw that term used in Perl, meaning to expand (perl)
variables in place in a string, but I didn't remember it or recognize
it in this context until a few posts in.
> > The real problem is that I want to replace some bash variables in a
> > file and then print the output.
A common term for expanding variables or tokens in a file is 'template
expansion'. I shy away from eval, so would probably treat the variables
as string tokens and subsitute the values in a loop.
Ken
- [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, 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, 2015/03/20
- Re: [Help-bash] bash variable interpolation, Dan Douglas, 2015/03/21