记录 时间,用户,地址,历史命令

vim /etc/profile
USER_IP=`who -u am i 2> /dev/null | awk '{print $NF}' | sed -e 's/[()]//g'`
PROMPT_COMMAND='date "+[ %Y%m%d-%H:%M:%S $LOGNAME from $USER_IP ]: `history 1 |cut -c 8-`" >> /var/log/command.log'
source /etc/profile