The linux command line tool env
can dump the current environment.
Since there are some special characters I want to use env -0
(end each output line with 0 byte rather than newline).
But how to load this dump again?
Bash Version: 4.2.53
On the Projects page, select the project that you want to import environment variables to, and click Properties to open the Project Properties window. On the General page, click Environment. In the Environment Variables dialog, click Import from File.
Don't use env
; use declare -px
, which outputs the values of exported variables in a form that can be re-executed.
$ declare -px > env.sh
$ source env.sh
This also gives you the possibility of saving non-exported variables as well, which env
does not have access to: just use declare -p
(dropping the -x
option).
For example, if you wrote foo=$'hello\nworld'
, env
produces the output
foo=hello
world
while declare -px
produces the output
declare -x foo="hello
world"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With