history优化设置

编辑/etc/profile文件,添加如下内容

export HISTFILE=$HOME/.bash_history
export HISTSIZE=2000
export HISTFILESIZE=2000
export HISTTIMEFORMAT="%F %T `whoami` "
export PROMPT_COMMAND="history -a; history -c; history -r;"
shopt -s histappend
typeset -r PROMPT_COMMAND
typeset -r HISTTIMEFORMAT `` > /etc/profile.d/history.sh ``

重新连接终端,即可

/etc/profile中添加shell脚本调试参数扩展

export PS4='+{$LINENO:${FUNCNAME[0]}}' 

使用

sh -xv <脚本> 

也可将调试信息重定向到另一个文件,方便查看

sh -xv <脚本> >& debug.txt

 

posted @ 2015-10-13 09:24  唐小柒  阅读(387)  评论(0编辑  收藏  举报