[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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