IP Address
Does anyone have any ideas how I can use script to obtain the IP address of the machine it is run on? I have looked through the bash environment variables but can't find anything that might help. Basically I have a dynamic IP with my ISP and I'm trying to write a script that will ftp my ip address in a txt to a different location every hour or so.
Paddy |
To get your IP address from cli >
lynx -dump http://whatismyip.com | awk '/Your/ {print $4}' |
You can also take a look at www.dyndns.org. There you can link a dynamic ip to a static computer name.
|
Thanks for the help. I have edited your command slightly so that I can get the ip address from the output of the ifconfig command like this.
Code:
ifconfig eth1 | awk '/Bcast/ {print $3}' | tail -c 15 |
That wouldn't do me any good.
Code:
mingdao@james:~$ /sbin/ifconfig eth0 | awk '/Bcast/ {print $3}' | tail -c 15 |
Yeah I suppose if you are behind a router it wouldn't be much use but in my case my computer is plugged directly into my modem so works for me.
Paddy |
All times are GMT -5. The time now is 06:45 PM. |