From 32c7ac59577ac7fa5540821f32918046f7b3437d Mon Sep 17 00:00:00 2001 From: diandian Date: Sat, 15 Apr 2023 22:59:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'Shell-MD/shell=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E6=A1=88=E4=BE=8B.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shell-MD/shell脚本案例.md | 50 ----------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 Shell-MD/shell脚本案例.md diff --git a/Shell-MD/shell脚本案例.md b/Shell-MD/shell脚本案例.md deleted file mode 100644 index d3bf12d..0000000 --- a/Shell-MD/shell脚本案例.md +++ /dev/null @@ -1,50 +0,0 @@ -

shell脚本案例

- -作者:行癫(盗版必究) - ------- - -## 一:脚本案例 - -#### 1.配置静态IP案例 - -```shell -#!/bin/bash -# This script configures a static IP address on CentOS 7 - -# Define variables for the IP address, netmask, gateway, and DNS servers -IP_ADDRESS=192.168.1.100 -NETMASK=255.255.255.0 -GATEWAY=192.168.1.1 -DNS_SERVERS="8.8.8.8 114.114.114.114" - -# Backup the original network configuration file -cp /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens33.bak - -# Modify the network configuration file with the static IP address, netmask, gateway, and DNS servers -cat << EOF > /etc/sysconfig/network-scripts/ifcfg-ens33 -TYPE=Ethernet -BOOTPROTO=none -NAME=ens33 -DEVICE=ens33 -ONBOOT=yes -IPADDR=$IP_ADDRESS -NETMASK=$NETMASK -GATEWAY=$GATEWAY -DNS1=${DNS_SERVERS%% *} -DNS2=${DNS_SERVERS##* } -EOF - -# Restart the network service to apply the changes -systemctl restart network - -# Display the new network configuration -ip addr show ens33 -``` - -centos stream 9 - -``` - -``` -