getdnsfromdhcpc.pl
来自「IPcop软路由防火墙 FREE 开源源代码」· PL 代码 · 共 33 行
PL
33 行
#!/usr/bin/perl## Helper program to get DNS info from dhcpc .info file.## (c) Lawrence Manning, 2001use strict;require 'CONFIG_ROOT/general-functions.pl';my $count = $ARGV[0];my ($dhcp, $dns, @alldns, %dhcpc);if ($count eq "" || $count < 1) { die "Bad DNS number given"; }if (open(FILE, "${General::swroot}/red/iface")) { my $iface = <FILE>; close FILE; chomp ($iface); if (!&General::readhash("${General::swroot}/dhcpc/dhcpcd-$iface.info", \%dhcpc)) { die "Could not open dhcpc info file"; }} else { die "Could not open interface file";}$dns = $dhcpc{'DNS'};@alldns = split(',', $dns);print "$alldns[$count - 1]\n";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?