[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: IP Address Variable?
- From: Michael Fratoni <mfratoni tuxfan homeip net>
- To: redhat-list redhat com
- Subject: Re: IP Address Variable?
- Date: Tue Jul 30 22:57:11 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tuesday 30 July 2002 10:37 pm, Joe Giles wrote:
> Is there a preset variable in Linux that stores your IP address?
>
> I use DHCP, and I would like to use an IP variable (If one exists) to
> set my DISPLAY option... Can anyone help ?
>
> Example
>
> display=$MYIP:0;export display
>
> There $MYIP would be the actual Linux variable to export...
Not that I am aware of, but obtaining the info and exporting it is easy
enough. Probably lots of better ways, but this should do it:
display=`/sbin/ifconfig eth0 | grep "inet addr" | cut -d : -f 2 | \
cut -d " " -f 1`; export display
Obviously, adjust "eth0" to suit the device in question.
- --
- -Michael
pgp key: http://www.tuxfan.homeip.net:8080/gpgkey.txt
Red Hat Linux 7.2 in 8M of RAM: http://www.rule-project.org/
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj1HUS4ACgkQn/07WoAb/SsDxQCePSsHGz982qQxVJlRvko7J3pA
IdgAnjZoPfn+1zT6REjY/8bdcmeLZUWJ
=93Qi
-----END PGP SIGNATURE-----
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]