[ale] Get host's IP address as an unprivileged user?

James Sumners james.sumners at gmail.com
Fri Jun 3 09:25:15 EDT 2011


I need to get the IP address of the local machine on which a script is
being executed. The script is going to be run by an unprivileged user
(so /sbin is not in the PATH). Does anyone know of a better way than
this:

IP=$(host $(hostname) | awk '{print $4}')

-- 
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59


More information about the Ale mailing list