/[cvs]/nfo/bash/getns
ViewVC logotype

Annotation of /nfo/bash/getns

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Oct 12 22:31:21 2004 UTC (20 years, 2 months ago) by rabit
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +8 -8 lines
M Title output.

1 rabit 1.1 #!/bin/sh
2     #---------------------------------------------------------------------
3 rabit 1.2 N='getns'
4     C='rabit@netfrag.org, 11.10.2004'
5     F="$N - Get nameserver"
6     I='$Id: getns,v 1.1 2004/10/12 22:23:11 rabit Exp $'
7 rabit 1.1 #---------------------------------------------------------------------
8    
9     NSList='/etc/resolv.conf'
10    
11     E='echo -e'
12     YW="\033[1;33m"
13     GY="\033[0;37m"
14     B1="\033[1m"
15     B0="\033[0m"
16    
17     Arg=$1
18     case "$Arg" in
19     (-c)
20     cat $NSList | grep 'nameserver' | cut -d ' ' -f 1 | wc -w
21     exit
22     ;;
23     (-h|--help)
24     ;;
25     (?*)
26     if ((Arg>0)); then
27     #if [ -n "$Arg" ] && ((Arg>0)); then
28     head -n $1 $NSList | grep 'nameserver' | tail -n 1 | cut -d ' ' -sf2
29     exit
30     fi
31     ;;
32     esac
33    
34 rabit 1.2 $E "$YW$F$GY ($C)\n($I)"
35 rabit 1.1 $E $B1'Usage:'$B0
36 rabit 1.2 $E ' '$B1$N' <number>'$B0
37 rabit 1.1 $E " Print the $B1<number>${B0}ths nameserver IP from '$B1$NSList$B0'."
38     $E " If no name servers are available result is empty, if $B1<number>$B0 is greater"
39     $E " than server entries available, the last one is printed."
40 rabit 1.2 $E ' '$B1$N' -c'$B0
41 rabit 1.1 $E " Print the count of name server entries in '$B1$NSList$B0'."
42 rabit 1.2 $E ' '$B1$N' [-h|--help]'$B0
43 rabit 1.1 $E " Show this help and exit."

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed