HUHU_1208
2018-10-15 02:33
采纳率: 50%
浏览 3.6k
已采纳

shell脚本包含明文密码,如何隐藏明文密码?

shell脚本包含明文密码,如何隐藏明文密码?

 #!/bin/bash
partition_list=(`df -h | awk 'NF>3&&NR>1{sub(/%/,"",$(NF-1));print $NF,$(NF-1)}'`)
critical=80
notification_email()
{
    emailuser='Yuki_hu@1208.com'
    emailpasswd='明文密码'
    emailsmtp='smtpav.travelsky.com'
    sendto='kkk@tra.com'
    title='Server Disk Space Alarm'
    /home/jcf/huhu/sendEmail-v1.56/sendEmail -f $emailuser -t $sendto -s $emailsmtp -u $title -xu $emailuser -xp $emailpasswd
}
crit_info=""
for (( i=0;i<${#partition_list[@]};i+=2 ))
do
    if [ "${partition_list[((i+1))]}" -lt "$critical" ];then
        echo "OK! ${partition_list[i]} used ${partition_list[((i+1))]}%"
    else        
            if [ "${partition_list[((i+1))]}" -gt "$critical" ];then
                crit_info=$crit_info"Warning!!! ${partition_list[i]} used ${partition_list[((i+1))]}%\n"
            fi 
    fi
done
if [ "$crit_info" != "" ];then
    echo -e $crit_info | notification_email
fi

希望大神帮忙解答,谢谢~~

1条回答 默认 最新

相关推荐 更多相似问题