View Single Post
Posts: 151 | Thanked: 93 times | Joined on Sep 2009 @ sofia, bulgaria
#11
You can also use this:

Code:
> echo $TRE

> ./tre.sh TRE=trep
> echo $TRE        
trep
>
file tre.sh
Code:
#!/usr/bin/env ksh

PID=$PPID
 
echo "Modifying $PID to set $1"
TMPFILE=/tmp/tre.tmp
cat<<EOF >$TMPFILE
attach $PID
call putenv ("$1")
detach
EOF
cat $TMPFILE
gdb -batch -x $TMPFILE > /dev/null
 
rm $TMPFILE
Although I prefer the exec solution more than this one. This requires gdb.
 

The Following 2 Users Say Thank You to lidow For This Useful Post: