[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Get host's IP address as an unprivileged user?
- Subject: [ale] Get host's IP address as an unprivileged user?
- From: james.sumners at gmail.com (James Sumners)
- Date: Fri, 3 Jun 2011 09:25:15 -0400
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