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: Chet Ramey
Subject: Re: [Help-bash] How to print a bash variable in the most succinct way?
Date: Tue, 16 Aug 2016 10:46:22 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 8/15/16 11:36 PM, Peng Yu wrote:
> On Wed, Aug 10, 2016 at 7:40 AM, Greg Wooledge <address@hidden> wrote:
>> On Wed, Aug 10, 2016 at 05:47:03AM -0500, Peng Yu wrote:
>>> I need the most human readable repesentation. The one returned by declare
>>> has redundancy in it. E.g., [1]= is not really necessary.
>>
>> Stop complaining that autogenerated code is less elegant than
>> human-written code.  Write the code yourself if you don't like what a
>> computer wrote for you.
> 
> https://www.gnu.org/software/parallel/env_parallel.html
> 
> env_parallel uses something like `declare -p` to extract the current
> environment so that the variables and functions in the current bash
> can be used to parallel sessions. But env_parallel also remove
> variables like BASH_* with grep as they should not be inherented in
> child parallel session.

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.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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