更新 'newset.sh'

This commit is contained in:
wzj 2022-12-13 14:57:41 +08:00
parent 92a5c35a53
commit e3dd04a0ba

View File

@ -78,24 +78,24 @@ cat>>/etc/profile<<EOF
PS1='\e[1;37m[\e[m\e[1;32m\u\e[m\e[1;33m@\e[m\e[1;35m\H\e[m \e[4m\`pwd\`\e[m\e[1;37m]\e[m\e[1;36m\e[m\n$'
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
if [ "\$USER_IP" = "" ]
then
USER_IP=`hostname`
USER_IP=\`hostname\`
fi
if [ ! -d /var/log/history ]
then
mkdir -p /var/log/history
chmod 777 /var/log/history
fi
if [ ! -d /var/log/history/${LOGNAME} ]
if [ ! -d /var/log/history/\${LOGNAME} ]
then
mkdir -p /var/log/history/${LOGNAME}
chmod 300 /var/log/history/${LOGNAME}
mkdir -p /var/log/history/\${LOGNAME}
chmod 300 /var/log/history/\${LOGNAME}
fi
export HISTSIZE=4096
DT=`date "+%Y-%m-%d_%H:%M:%S"`
export HISTFILE="/var/log/history/${LOGNAME}/${USER_IP}-log.$DT"
chmod 600 /var/log/history/${LOGNAME}/*log* 2>/dev/null
DT=\`date "+%Y-%m-%d_%H:%M:%S"\`
export HISTFILE="/var/log/history/\${LOGNAME}/\${USER_IP}-log.$DT"
chmod 600 /var/log/history/\${LOGNAME}/*log* 2>/dev/null
######################代码结束#######################
EOF
}