Starting a dev server with the right IP address

I often need to start a dev server with my current IP address. I don’t want to use, because other computers on the network, or mobile phones on wifi, etc, can’t access it. So I need the IP address attributed by my router to my computer. Here is how to get it in 1 line of bash:

IP=`ifconfig wlan0 | \
    grep 'inet addr:'| \
    cut -d: -f2 | \
    awk '{ print $1}'`

# Then, for example start the server with:
./main --ip=$IP

I suppose it works on ubuntu linux as of today, but is pretty dependent on the output of the ifconfig command. Should be easy to adapt if needed.

GNU Screen sessions - sort of. » « Restore Grub after windows....