gvar(1) -- display, set, or remove global variables*.
* When I say global variable, I refer to a key-value pair that you can read/write at any time in any terminal session. You can think this is similar to the environment variables because it's a set of dynamic-named values but they are not session-wide or system-wide related.
gvar is a pure Bash key-value store where each user has a different collection
of data. The records are stored in the user's home directory as ~/.gvar
file.
Clone this repository:
$ git clone [email protected]:arturoherrero/gvar.git
Add gvar/bin/
to your PATH
:
$ echo 'export PATH="${PATH}:path/to/gvar/bin"' >> ~/.bash_profile
Source your profile:
$ source ~/.bash_profile
$ brew tap arturoherrero/formulae
$ brew install gvar
To print out the names and values of all the global variables, use:
$ gvar
To set global variables, use arguments of the form <VARIABLE>=<VALUE>
,
setting variable <VARIABLE>
to value <VALUE>
:
$ gvar VARIABLE=VALUE
Setting a global variable to an empty value is different from unsetting it:
$ gvar VARIABLE=
To print the value of the global variable <VARIABLE>
, use:
$ gvar VARIABLE
To remove (unset) a global variable <VARIABLE>
, use:
$ gvar -u VARIABLE
$ gvar --unset=VARIABLE
To delete the environment, removing all the global variables, use:
$ gvar -d
$ gvar --delete-environment
This was made by Arturo Herrero under the MIT License. Find me on Twitter @ArturoHerrero.