How to grep dhcp ip address

Hi,

I have a script that my operators use as a login profile.
As they need to export their display in order to access the GUI of the data protector program in HPUX machine.
Anyone can advise how I can grep (eg. who -r) the dynamically assigned IP address and automatically put it as a variable in my script. So whenever I login, the script will do a grep of my current IP add and do a replacement of the ip in the script as needed.

Thanks and best regards
Solomon

Once logged into the target machine:

who am i | sed 's/[^(]*(\([^)]*\))/\1/'

hmm, who am i does not show the user IP address.

presently in the script the display set is hard coded:

DISPLAY=XX.X.XX.XX:0.0
export DISPLAY

how to make the dhcp assigned user IP address update dynamically?

try

hostname --ip-address

At least this works for a fixed IP address on a Linux box.

on a FreeBSD box you can also try

ifconfig

There you still have to parse output according to your needs.

sorry on HPUX use who -R