Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Mar 12, 2006
1 parent b7b6e10 commit 6385484
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bin/pingns
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ -n "$1" ]; then
num="$1"
shift
else
num=1
fi

ns=$( perl -0777ne 'my @ns = /^ *nameserver +([0-9.]+)/mg;
print $ns['$num' - 1] || ""' \
/etc/resolv.conf )

if [ -z "$ns" ]; then
echo "Could not find nameserver $num in /etc/resolv.conf" >&2
exit 1
fi

ping "$@" "$ns"

0 comments on commit 6385484

Please sign in to comment.