~nick-moffitt/charms/precise/mysql/mysql-shopt-is-a-shell-builtin

« back to all changes in this revision

Viewing changes to lib/net.sh

  • Committer: Marco Ceppi
  • Date: 2014-03-18 20:08:17 UTC
  • Revision ID: marco@ceppi.net-20140318200817-yqgqxgbyfrb2ktdn
If ip is an ip then return ip

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
        local HOST="$1"
168
168
        #So, if there's multiple IP addresses, just grab the first
169
169
        # for now.
 
170
        if [ `ch_is_ip "$HOST"` ]; then
 
171
                echo "$HOST"
 
172
                return 0
 
173
        fi
 
174
 
170
175
        local CHECK_IP=$(host -t A $HOST | awk 'NR==1{ print $4 }')
171
176
 
172
177
        if [ ! `ch_is_ip "$CHECK_IP"` ]; then