解决CentOS终端命令不同步问题

history(){
  syncHistory
  builtin history "$@"
}

syncHistory(){
  builtin history -a
  HISTFILESIZE=$HISTFILESIZE
  builtin history -c
  builtin history -r
}

promptCommand(){
  if [ "$TERM" = xterm ]
  then case "$DISPLAY" in
       :*)  printf "\033]0;%s\007"                     "$PWD" ;;
       *)   printf "\033]0;%s -- %s\007" "$HOST_UPPER" "$PWD" ;;
       esac
  fi
  syncHistory
}

HOST_UPPER=`echo $HOSTNAME | tr '[a-z]' '[A-Z]'`
PROMPT_COMMAND=promptCommand

贴在.bashrc即可

上一篇:[转]Python-__builtin__与__builtins__的区别与关系(超详细,经典)


下一篇:后台返回前台图片二进制byte[]数据,前台获取