[ale] Get host's IP address as an unprivileged user?
JD
jdp at algoloma.com
Sat Jun 4 07:28:38 EDT 2011
On 06/03/2011 09:25 AM, James Sumners wrote:
> 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}')
>
I never trust the PATH in scripts. Anyone can call /sbin/ifconfig.
If you must, just add :/sbin to your PATH (ew).
More information about the Ale
mailing list