comparison bin/procenv.sh @ 342:481b55fc4b96

added utility to get process env variables
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 22 Jun 2013 15:58:21 -0700
parents
children
comparison
equal deleted inserted replaced
341:4387fa22807f 342:481b55fc4b96
1 #!/bin/bash
2
3 # process environment
4 # list process environment variables
5
6 # must be run as root
7 if [[ "$(whoami)" != "root" ]]
8 then
9 echo "must be run as root"
10 exit 1
11 fi
12
13 # loop over arguments
14 for PROG in $@
15 do
16 EXIT=0
17 if PID=$(pidof -x ${PROG})
18 then
19 echo '='${PROG}: ${PID}'='
20 cat /proc/${PID}/environ | tr '\000' '\012' | sort
21 else
22 EXIT=1
23 echo ""
24 fi
25 done