📄 genstatic
字号:
#!/bin/sh# @(#) genstatic 1.4 92/08/31 @(#)# generate the static hosttable from database files# called from updatehosts## files used# hosts.local# hosts.main# hosts.cname# Copyright (c) 1992 by Texas Internet Consulting# This code may be freely copied and used so long as this# copyright notice is attached. This code may not be sold# without the express written permission of Texas Internet Consulting.# Texas Internet Consulting makes no warranty as to the correctness# nor the applicability of this code for any purpose.# this cannot be /etc/hostsHOSTS=hosts.staticSERIAL=serialPATH=.:$PATH# put the serial number of this table as the first lineserial=`cat $SERIAL`echo "# $serial" >$HOSTS# extract host name and IP address from hosts.mainreadinfo ip host <hosts.main | awk '{ # split up the domain name n = split($2, domain, ".") printf("%s %s %s\n", $1, $2, domain[1])}' >>$HOSTS# build edit script for aliasesreadinfo host alias <hosts.cname | awk '{ # extract simple alias name from domain name n = split($2, alias, ".") # split up the domain name n = split($1, domain, ".") # build the edit command for this line # will look like /<domain>/s/$/<alias> <alias.domain>/ edcmd = "/" domain[1] # replace "." with "\." for (i=2; i<=n; i++) { edcmd = edcmd "\\." domain[i] } edcmd = edcmd "/s/$/ " $2 " " alias[1] "/" print edcmd}END { print "w" print "q"}' | ed >/dev/null 2>&1 $HOSTS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -