D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] bash shell script question

 

On 02/01/15 18:10, Gordon Henderson wrote:
> On Fri, 2 Jan 2015, Martijn Grooten wrote:

Just another "I do it like this" post. hostname can return too much
information whereas this will *usually* get what you want:

ip route get 8.8.8.8 | awk 'NR==1 {print $NF}'

Obviously still not perfect but usually how I script it.


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq