# 1.定义相关变量
default_path=/etc/sysconfig/network-scripts/
host_ens=$(find /etc/sysconfig/network-scripts/ -name ifcfg-ens* | awk 'BEGIN{FS="/"}{print $NF}')# 2.让用户选择是否需要修改IP地址
read -p '请确认是否修改IP地址(y/
原创
2024-06-21 23:30:14
576阅读
shell脚本建议执行流程如下图:
#!/bin/sh #脚本用途:用来设置IP、子网掩码、默认网关以及DNS #用法:sh name.sh [-i ipadress] [-n netmask] [-g gateway] #[-d dns] #注意:1
原创
2012-09-18 21:35:49
3317阅读
点赞
1评论
#!/bin/bashA="IPADDR.*"B="NETMASK.*"C="GATEWAY.*"D="DNS1.*"E="/etc/sysconfig/network-scripts/ifcfg-eth1"F="cat$E|sed-n'/BOOTP/p'"if[!"$F"="BOOTPROTO=dhcp"]thenread-t30-p"PleaseentertheIPaddress:"IPrea
原创
2018-08-19 15:38:35
2937阅读
shell脚本如下:#!/bin/bash
#该脚本用于设置网卡的IP地址
#第一部分:变量的设置
ETH=$(ifconfig | grep "^eth" | awk '{print$1}')
MAC=$(ifconfig | grep "^eth" | awk '{print$5}')
read -p "请输入设置IP地址:" IP
read -p "请输入设置的网关:" GW
read -
转载
2023-06-14 11:08:05
204阅读
[root@kongxl shell]# cat mod_ip_hostname.sh
#!/bin/bash
#Auto modify ip and hostname
#by colin on 2015-05-07
IP_CONFIG='/etc/sysconfig/network-
原创
精选
2015-05-08 15:23:49
2982阅读
需求shell脚本里我需要根据不同的ip地址做出不同的操作,因此我需要在shell脚本里获取当前主机的ip地址我需要获取到192.168.1.111这个ip地址方法1ifconfig |grep 'inet 地址'|grep '192.168.1' | grep -v 'grep' | awk '{print $2}'| tr -d "地址:"效果
转载
2013-02-01 20:26:00
754阅读
2评论
公司三台服务器分别要绑定15个虚拟IP地址,所以写了以下脚本来实现.ip---> 为start_ip或end_ip地址前三段(需相同).start_num---> 为start_ip最后一段end_num---> 为end_ip最后一段#/bin/bashpath=/etc/sysconfig/network-scripts/cd $pathread -p "input
原创
2013-06-11 15:39:22
1460阅读
#!/bin/bashread-p请输入一个地址:IP[["$IP"=~^(([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$]]&&echoitisok
原创
2019-08-13 16:12:09
1821阅读
点赞
#!/bin/bash
#author:
#date:2015-6-13
#filename:ip.sh
#############################
ifconfig_cmd=`which ifconfig`
$ifconfig_cmd > ifconfig.me
###################################
funct
原创
2015-06-13 18:09:16
2170阅读
#!/bin/bash#AutomodifyipandhostnameIP_CONFIG='/etc/sysconfig/network-scripts/ifcfg-eth0'HOSTNAME_CONFIG='/etc/sysconfig/network'HOSTS_CONFIG='/etc/hosts'#定义一个IP主要内容数组a=0#定义变量a为
原创
2019-03-11 11:12:28
3669阅读
#!/usr/bin/shcheck_ipaddr(){ echo $1|grep "^[0-9]\{1,3\}\.\([0-9]\{1,3\}\.\)\{2\}[0-9]\{1,3\}$" > /dev/null; if [ $? -ne 0 ] then echo "IP地址必须全部为数字" return 1 fi
原创
2022-01-13 09:50:56
1162阅读
1评论
基于Linux系统的获取外网IP地址的shell脚本,脚本内容如下: getIp.sh#!/bin/bash#检查IP的合法性check_ipaddr(){ echo $1|grep "^[0-9]\{1,3\}\.\([0-9]\{1,3\}\.\)\{2\}[0-9]\{1,3\}$" > /dev/null; if [ $? -ne 0 ] then...
原创
2022-02-25 16:43:08
1443阅读
基于Linux系统的获取外网IP地址的shell脚本,脚本内容如下: getIp.sh#!/bin/bash#检查IP的合法性check_ipaddr(){ echo $1|grep "^[0-9]\{1,3\}\.\([0-9]\{1,3\}\.\)\{2\}[0-9]\{1,3\}$" > /dev/null; if [ $? -ne 0 ] then...
原创
2021-09-01 09:29:51
1746阅读
#!/bin/bash
for ((a=1;a<254;a++))
do
for ((b=0;b<254;b++))
do
for ((c=0;c<254;c++))
do
for ((d=1;d<254;d++))
do
echo $a.$b.$c.$d>>ips.txt
done
done
done
done
&n
原创
2011-01-22 09:32:13
5739阅读
点赞
shell脚本统计IP归属地址
原创
2018-08-29 13:17:10
1216阅读
点赞
#!/bin/bash#安装配置DNS. ./yumrpm -q "bind" &>/dev/nullif [ $? -ne 0 ];then yum_a yum -y install bind bind-chroot&nb
原创
2014-01-17 16:32:21
1323阅读
#!/bin/bash
FILE='/root/ip'
read -p "ipaddr:" MYIP
read -p "netmask:" MYMASK
if grep -E "^BOOTPROTO=(dhcp)|(bootp)$" $file &>/dev/null ;then
sed -i "s/^B
原创
2010-12-23 17:55:50
2929阅读
点赞
#!/bin/bash
FILE='/root/ip'read -p "ipaddr:" MYIPread -p "netmask:" MYMASK
if grep -E "^BOOTPROTO=(dhcp)|(bootp)$" $file &>/dev/null ;thensed -i "s/^BOOTPROTO=.*/BOOTPROTO=static/g" $file
gr
原创
2010-12-24 21:46:42
722阅读
下载hadoop安装包可以到这个网站上下载http://www.apache.org/dist//hadoop/core/如果下载不下来自己到网上找找很多的。选一个版本下载。我用的是hadoop-0.20.2。2.解压到一个目录下。随便选择按个目录。建议直接选择一个根目录。随后进行配置。这里配置的是伪分布式了。需要配置四个文件。都在conf目录下。分别为:hadoop-env.sh、core-si
转载
2024-07-26 12:50:50
58阅读
单个获取 编写角本pingip.sh #!/bin/sh ADDR=qq.com TMPSTR=`ping ${ADDR} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'` echo ${TMPSTR} echo ${TMPSTR} >> 666.txt 执行结果 haim
转载
2021-08-13 16:08:47
4685阅读