IP address variable
Mike Burger
mburger at bubbanfriends.org
Wed Feb 16 12:50:52 UTC 2005
On Mon, Feb 14, Dave 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.
Actually, chances are pretty good that it's tripping over the use of
straight quotes (') instead of angled ones (`).
Paul...replace the ' at the beginning and end of your variable
declaration with `, and it should work properly.
--
Mike Burger
http://www.bubbanfriends.org
Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org
To be notified of updates to the web site, visit
http://www.bubbanfriends.org/mailman/listinfo/site-update, or send a
message to:
site-update-request at bubbanfriends.org
with a message of:
subscribe
More information about the fedora-list
mailing list