<p>$ ip ls</p>
<p>You can grep for the if you're interested in. ip, from the iproute2 package, is the preferred mechanism for working with the networking stack in Linux; it is far more capable than ifconfig is.</p>
<p>--<br>
Sent from my phone... a G2 running CM7 nightlies!</p>
<div class="gmail_quote">On Jun 4, 2011 1:51 AM, "James Sumners" <<a href="mailto:james.sumners@gmail.com">james.sumners@gmail.com</a>> wrote:<br type="attribution">> I need to get the IP address of the local machine on which a script is<br>
> being executed. The script is going to be run by an unprivileged user<br>> (so /sbin is not in the PATH). Does anyone know of a better way than<br>> this:<br>> <br>> IP=$(host $(hostname) | awk '{print $4}')<br>
> <br>> -- <br>> James Sumners<br>> <a href="http://james.roomfullofmirrors.com/">http://james.roomfullofmirrors.com/</a><br>> <br>> "All governments suffer a recurring problem: Power attracts<br>> pathological personalities. It is not that power corrupts but that it<br>
> is magnetic to the corruptible. Such people have a tendency to become<br>> drunk on violence, a condition to which they are quickly addicted."<br>> <br>> Missionaria Protectiva, Text QIV (decto)<br>> CH:D 59<br>
> _______________________________________________<br>> Ale mailing list<br>> <a href="mailto:Ale@ale.org">Ale@ale.org</a><br>> <a href="http://mail.ale.org/mailman/listinfo/ale">http://mail.ale.org/mailman/listinfo/ale</a><br>
> See JOBS, ANNOUNCE and SCHOOLS lists at<br>> <a href="http://mail.ale.org/mailman/listinfo">http://mail.ale.org/mailman/listinfo</a><br></div>