IP address variable?

paul paul.hamradio at verizon.net
Mon Feb 14 22:13:15 UTC 2005


----- Original Message ----- 
From: "Rick Stevens" <rstevens at vitalstream.com>
To: "For users of Fedora Core releases" <fedora-list at redhat.com>
Sent: Monday, February 14, 2005 2:08 PM
Subject: Re: IP address variable?


> Dave Jones wrote:
>> On Mon, Feb 14, 2005 at 01:59:19PM -0800, paul wrote:
>>  > > > Hello All,
>>  > > I need to create a variable (or read an existing one) that returns 
>> the IP > address for eth0.
>>  > I used to do it like this under RH 7.2:
>>  > > IPADDR='ifconfig eth0|grep inet|cut -d ":" -f2|cut -d " " -f1'
>>  > > The result now under FC3 is:
>>  > > # $IPADDR
>>  > "inet|cut: Unknown host"
>>  > > Can anyone help me out here? I am having a hard time figuring this 
>> one out.
>>
>> It's falling over the fact that the grep matches 2 lines (ipv4 and ipv6).
>> grep for "inet addr" and it works fine.
>
> And make sure those single quotes are graves (backticks--the character
> under the "~" on most keyboards).
> ----------------------------------------------------------------------
> - Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
> - VitalStream, Inc.                       http://www.vitalstream.com -
> -                                                                    -
> -   To understand recursion, you must first understand recursion.    -
> ----------------------------------------------------------------------


Thanks Dave and Rick! I'm back in business.... 





More information about the fedora-list mailing list