# 1.依次展示/var目录下的对象,并说明是文件或者目录.格式如:Hello,$file. # 2.统计一个有多少个文件. #!/bin/bash #Program Description: #Author: Created by ctu_lzq #Date: // list=`ls /var |awk '{print $1}'` num=`ls /var |wc -l` for i in $list; do if [ -f "/var/$i" ];then echo "H…
#通过ping命令测试192.168.1段的所有主机是否在线,如果在线就显示is up并显示蓝色,如果不在线就显示is down. #!/bin/bash #Program Description: #Author: Created by ctu_lzq #Date: // net="192.168.1." ;i<=;i++)); do >& ];then echo -e "\033[34m$net$i is up \033[0m" else e…
IDC小菜鸟一枚,非科班出身.常常有客户的centos服务器需要分配15个IP甚至30个IP.每次需要手动分配十分麻烦,于是花了一天时间学了shell脚本,写了这个脚本. #!/bin/bash read -p "The IP numbers: " num while [[ $num -gt 0 ]] do read -p "Please enter IP Address :" ipaddr touch /etc/sysconfig/network-scripts/…