[Vm-dev] Finding ip address for eth0?

David T. Lewis lewis at mail.msen.com
Wed Aug 26 22:03:53 UTC 2009


On Wed, Aug 26, 2009 at 11:50:12AM -0700, Andreas Raab wrote:
> 
> Is there any way of finding out the IP address for eth0 that doesn't 
> involve OS process, sed, and grep?

Assuming that you're not looking for an elegant solution, you could
figure it out in the start script and pass it to Squeak as a command
line parameter.

  #!/bin/sh
  INTERFACE=eth0
  IPV4_ADDR=`/sbin/ifconfig $INTERFACE | grep 'inet addr' | cut -c21-34`
  echo the IP address on interface $INTERFACE is $IPV4_ADDR
  /usr/local/bin/squeak myimage.image $IPV4_ADDR

Dave



More information about the Vm-dev mailing list