标签:
以下内容在RHEL 6.4下测试通过。
#!/bin/bash [ -d /usr/lib/.cmdlog ] || mkdir -p /usr/lib/.cmdlog cmdlog_file="/usr/lib/.cmdlog/cmdlog.$(date +%F)" touch ${cmdlog_file} chmod 666 ${cmdlog_file} chattr +a ${cmdlog_file}
export CMDLOG_FILE="/usr/lib/.cmdlog/cmdlog.$(date +%F)" readonly PROMPT_COMMAND=‘{ date "+%y-%m-%d %T ##### $(who am i |awk "{print \$1\" \"\$2\" \"\$5}") #### $(pwd) #### $(history 1 | { read x cmd; echo "$cmd"; })"; } >> $CMDLOG_FILE‘
标签:
原文地址:http://www.cnblogs.com/Eivll0m/p/4626801.html