Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a WRT54GL with DD WRT, and having my domain hosted at zoneedit. For some reason, automatic dynamic DNS clients don't seem to work- they get the ipaddress of what i believe is a proxy server., so i want to throw together a script. In short i need to strip out the ipaddress from the output of ifconfig vlan1 (since vlan1 is the adaptor that's connected to my modem (grep gets me halfway there) and get it into a URL similar to 'wget -O - --http-user=username --http-passwd=password ' '

where myipaddress is replaced by the ipaddress i get from ifconfig vlan1. Any ideas on what the command should be? DDWRT uses busybox so anything i use needs to be from there

share|improve this question
up vote 1 down vote accepted

This should extract your IP address:

ifconfig vlan1 | grep "inet addr" | cut -d: -f2 | cut -d" " -f1

if you want to save it to a variable:

ip=$(ifconfig vlan1 | grep "inet addr" | cut -d: -f2 | cut -d" " -f1)

then throw it into your command:

wget -O - --http-user=username --http-passwd=password "$ip"

ifconfig, grep, and cut are available on BusyBox.

share|improve this answer
ahh, that works mostly. Looks like i have a neutered wget that won't accept the password command, but that's another issue – Journeyman Geek Dec 23 '09 at 9:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .