1 公司服务器每天关于SSH攻击的报警很烦人,于是就在抚琴煮酒大哥实例的基础上改编成以下脚本,略有不同:#!/bin/bash #Prevent SSH attack SLEEPTIME=30 lastb -n 500| grep -v "^$&qu
#!/bin/bash read -p "please input the zabbix server name:" $A read -p "please input your hostname:&q
公司要求为每位监控工程师在每台服务器上添加一个账号,以便他们来分析日志,要求登录即修改密码,于是写了个小脚本来实现,很简单: #!/bin/bash for A in {fan,huang,fang}; do useradd $A &nbs
#!/bin/bash read -p "Please enter your zone:" ZONE read -p "Please enter your IPNET,[Usage: 192.168.0.]:" NET YOURIP=`ifconfig eth0| grep "inet addr
getopts的简单应用: 脚本: #!/bin/bash while getopts ":a:b:c" SWITCH;do case $SWITCH in a) echo "choose -a" echo $OPTARG ;; b) echo "choose -b" echo $OPTARG ;; c) echo
1 编写一个脚本使我们在写一个脚本时自动生成"#!/bin/bash”这一行和注释信息。 #!/bin/bash if ! grep "^#!" $1 &>/dev/null; then cat >> $1 << EOF #!/bin/bash # Author: #Date & Tim
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号