This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: how to get IP with a shell command?


I rely more on where I'm logging into when automating my DISPLAY variable...
I assume that the parsed output of ipconfig might be incorrect in some
instances (for instance when I VPN to work and ipconfig display more than
one IP).  The output of "who am I" on the box you log into usually gives a
good address.

I put various if/else statements in my .bashrc and .cshrc on the boxes that
I log into that end up invoking this:

export DISPLAY=`who am i | sed -e 's/.*(\(.*\)).*/\1/'`:0.0

-Abe

-----Original Message-----

To set the environment variable DISPLAY for XFree I use the following
command

export DISPLAY=`\
    ipconfig | grep 'IP-Adresse' | \
    sed 's/\(.*: \)\([0-9][0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)\(.*\)/\2/g'`:0.0

'IP-Adresse' must be replaced with the proper version according to you
language.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]