The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 11-17-2008
Christoph Spohr Christoph Spohr is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 205
Hi,

keep it simple. A little test is enough:

[[ -s /etc/resolv.conf ]] && dns=( $(awk '/nameserver/{print $2}' /etc/resolv.conf ) )

This means:

if /etc/resolv.conf exists and is not empty, then and only then execute the following command.

Kind regards

Chris