[plug] getting IP address in a shell script

Colin Muller colin at twobluedots.com.au
Tue Jul 30 18:07:08 WST 2002


On Tue, Jul 30, 2002 at 05:57:46PM +0800, Craig Ringer wrote:
> Hi all
> Any ideas about a non-ugly (ie pref not /sbin/ifconfig eth0 | awk ... ) 
> method of getting the local machine's IP address into a variable in a 
> shell script? There's probably something obvious I'm missing but apropos 
> and google haven't helped on a quick glance.

Maybe this:
variable=`hostname -i`

Colin



More information about the plug mailing list