Sponsored Content
Full Discussion: Ip
Top Forums UNIX for Dummies Questions & Answers Ip Post 302106458 by reborg on Thursday 8th of February 2007 04:47:17 PM
Old 02-08-2007
This is an error prone way of doing things, there could be multiple lines that match, or the hostname could be in a commented line.

Getent is more reliable, and safe.

One way:

Code:
set -- $(getent hosts $(hostname))
ipaddress=$1

 
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy