Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-06-2005, 12:11 PM   #1
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
how to show the servers IP address in a shell script ?

hostname -i just give me the adress on the lo interface, i need the ip address from the eth0 interface
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-06-2005, 12:14 PM   #2
SinSational
Confirmed User
 
Join Date: Oct 2004
Location: Boston, MA
Posts: 1,723
ifconfig -a
__________________

ICQ# 273099174 - monthly specials - 2 Month Free Credit on All Plans - 100% Referrals - chris@ for details
Virtual from $14.95/month, Dedicated from $149.95/month
Dual-Core Xeon > 1000GB @ $149.95 | 1500GB @ $169.95 | 10Mbps @ $269.95
SinSational is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-06-2005, 12:18 PM   #3
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
Quote:
Originally Posted by SinSational
ifconfig -a
Yes, but that show all the info, i just need the IP.
I could do a grep, but aint there any commands getting the IP address ?
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-06-2005, 12:28 PM   #4
etech
Confirmed User
 
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
I got it, ifconfig eth0 |grep 'inet addr' |awk '{print $2}'
My main problem now is that I need to get that saved in a variable, and i cant do
VAR = ifconfig eth0 |grep 'inet addr' |awk '{print $2}'
echo $VAR
etech is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-06-2005, 12:53 PM   #5
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
backtick ?

get the ip from /etc/sysconfig/network-scripts/ifcfg-eth0 ?
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-06-2005, 02:21 PM   #6
SteveF
Confirmed User
 
Join Date: Jan 2005
Posts: 120
This example works in a bash environment, just surround your command line in such a fashion:

[sf@steve]$ export TEST=`ifconfig rl0|grep netmask|awk '{print $2}'`
-=[~]=- -=[Wed Jul 06]=- -=[17:18:06]=-
[sf@steve]$ echo $TEST
xxx.xxx.xxx.xxx (replaced for obvious reasons)

You'll have to narrow the search down more if you have virtual IPs bound to the same interface, etc.

S.
SteveF is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.