用来记录登录后使用命令的shell脚本

上传:qw77643 浏览: 16 推荐: 0 文件:PDF 大小:26.72KB 上传时间:2021-01-15 08:54:54 版权申诉
代码如下:#/bin/bash# history#把以下代码直接粘贴到/etc/profile后USER_IP=`who -u am i 2>/dev/null| awk ‘{print $NF}’|sed -e ‘s/[()]//g’`HISTDIR=/var/log/.histif [ -z $USER_IP ]then USER_IP=`hostname`fiif [ ! -d $HISTDIR ]then mkdir -p $HISTDIR chmod 777 $HISTDIRfiif [ ! -d $HISTDIR/${LOGNAME} ]then mkdir -p
上传资源
用户评论