This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# get env variable of the particular process. It can show variables that were created at runtime. Requires root privileges | |
# usage: sudo penv_runtime.sh pid var_name | |
# | |
pid=$1 | |
var_name=$2 | |
var_value=`gdb -q -batch -ex "attach $pid" -ex 'call (char*) getenv("'$var_name'")' -ex 'detach' | egrep '^\$1 ='` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# show env variables of the particular process that were created during process startup. requires root privileges | |
# usage: sudo penv.sh pid | |
pid=$1 | |
awk 'BEGIN {RS="\0"; ORS="\n"} $0' "/proc/$pid/environ" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# set or replace env variable in existing process. requires root privileges | |
# usage: sudo chenv.sh pid var_name var_value | |
# | |
pid=$1 | |
env_name=$2 | |
env_val="$3" |