help-bash
[Top][All Lists]
Advanced

[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: Thu, 19 Mar 2015 19:06:56 -0500

On Thu, Mar 19, 2015 at 7:03 PM, Dave Rutherford
<address@hidden> 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'?
>
>> The real problem is that I want to replace some bash variables in a
>> file and then print the output.
>
> Can you arrange things so that the file is given as a here-document?
> Here-documents are treated to variable expansion, and the results
> ought to be safe regardless of the variable contents.

Heredoc is good when the doc is short. But when the doc is long, it is
better to put it in a file.

Therefore, could there be a new feature in bash called, say, theredoc
be added for this case?

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]