Okay, I am trying to make a bash script to get a certain domains IP address (my home ip). My home is on a DHCP lease from my ISP, so I cannot always trust the IP address to remain constant.
This is what I have so far for it:
alias ip-home="ping -c 1 example.com | grep 'PING' | cut -d'(' -f2 | cut -d')' -f1";
But that outputs a line break afterwords. What I would really like is something that matches the output of:
curl -q www.whatismyip.com/automation/n09230945.asp
which is...
dev:~ tnanek$ curl -q www.whatismyip.com/automation/n09230945.asp
0.0.0.0dev:~ tnanek$
The IP was altered above, as well as the domain in the first statement.
I am on Snow Leopard 10.6.4, though it is built off of a Unix core.
For background on what I am trying to do ultumatly...
I am a Drupal developer, and I would like my .bashrc file to set my host entry appropriately to use a specific domain (not one set via my router) to point to my home computer. I will ultimatly be adding that, but meanwhile, now I'm only getting the ip address in a usable form.