bug-coreutils
[Top][All Lists]
Advanced

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

bug#12964: [PATCH] printenv: -n option added -- show names of variables.


From: Bernhard Voelker
Subject: bug#12964: [PATCH] printenv: -n option added -- show names of variables.
Date: Wed, 10 Oct 2018 11:03:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 10/9/18 11:33 PM, Assaf Gordon wrote:
> With your patch, using "printenv -n VARNAME" adds
> the variable name to the output. e.g.:
> 
>     $ printenv HOME
>     /home/gordon
> 
>     $ printenv -n HOME
>     HOME=/home/gordon
> 
> From a cursory look this seems like a non-standard extension
> that is not available in any other 'printenv' implementations.

This feature looks like it should be possible to write out the current settings
to a file which could later be sourced in:

  printenv -n VAR > file

and in another shell (to get VAR back):

  . file

I'm afraid this is problematic once the value of a variable starts to have
funny characters, even a simple blank ' ' already screws things up.
For this kind of save/restore, -n would need to do correct shell quoting.

Have a nice day,
Berny





reply via email to

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