首页 > 系统相关 >Shell脚本案例

Shell脚本案例

时间:2023-01-31 15:38:31浏览次数:58  
标签:脚本 profile Shell MIN DAYS 案例 Num passmin PASS

检查脚本

 

修复脚本

#!/bin/bash
Count_passmin=`cat /etc/profile | grep -n ^PASS_MIN_DAYS | awk -F[:] '{print $1}'`
if [ "$Count_passmin" ];then
	Num_passmin=1
	for a in $Count_passmin
	do
	echo $Num_passmin
	if [ $Num_passmin == 1 ];then
		sed -i $a'c PASS_MIN_DAYS	2' /etc/profile
	else
		sed -i $a'c #PASS_MIN_DAYS重复配置已替换' /etc/profile
	fi
	Num_passmin=$Num_passmin+1
	done
else
	echo "PASS_MIN_DAYS   2" >> /etc/profile
fi

 

标签:脚本,profile,Shell,MIN,DAYS,案例,Num,passmin,PASS
From: https://www.cnblogs.com/Magiclala/p/17079261.html

相关文章