help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] How to print a bash variable in the most succinct way?


From: Peng Yu
Subject: Re: [Help-bash] How to print a bash variable in the most succinct way?
Date: Tue, 16 Aug 2016 14:21:52 -0500

On Tue, Aug 16, 2016 at 12:43 PM, Chet Ramey <address@hidden> wrote:
> On 8/16/16 11:50 AM, Peng Yu wrote:
>
>>> This isn't a very good idea.  If you have to do something like this, it's
>>> better to mark or tag the variables you want to `export', write them to a
>>> file, and have the child process read the file.
>>
>> What if I want to export every variable that bash does not use
>> internally? The problem of manually specifying the variables needed is
>> that it not a scalable solution when the bash code involves many
>> variables. Any other better walk-around?
>
> Generate a list of variables you want to export, generate a list of all
> shell variables (`compgen -v' is a quick way to do that), export the
> variables you want, and use `export -n' to unexport the ones you want
> to stay local.

How to only generate variables that are modifiable (i.e., not readonly)?

-- 
Regards,
Peng



reply via email to

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