Artificial intelligent assistant

How to change /proc/*/environ of a bash shell This is the shell's PID: nathan@guixlaptop ~ $ $$ bash: 10984: command not found I export an environment variable: nathan@guixlaptop ~ $ export TESTVAR=test The variable is not found in the shell's environment: nathan@guixlaptop ~ $ cat /proc/10984/environ | grep TESTVAR || echo "fail" fail How do I make the variable appear in environ?

I think you'll need to deal with the NUL-separated strings, and restart the shell to see the result you're looking for:


$ $$
bash: 9166: command not found
$ export TESTVAR=test_question

# at this point, you can check `/proc/9166/environ`, but `TESTVAR` won't show up until the shell is re-started

$ tr '\0' '\
' < /proc/9166/environ
SHELL=/bin/bash
NO_AT_BRIDGE=1
PWD=/home/pi
LOGNAME=pi
# ... etc, etc - the env var TESTVAR is not there...

$ tr '\0' '\
' < /proc/9166/environ | grep TESTVAR
$

# re-start bash & try again:

$ exec bash

$ tr '\0' '\
' < /proc/9166/environ | grep TESTVAR
TESTVAR=test_question
$



Attribution to @aviro & @stephenkitt for the simplifications (see comments)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 38e230e66f0613f26a67e15f3d8ca143