sh bash命令错误视图。来自:http://qiita.com/takayuki206/items/f4d0dbb45e5ee2ee698e

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh bash命令错误视图。来自:http://qiita.com/takayuki206/items/f4d0dbb45e5ee2ee698e相关的知识,希望对你有一定的参考价值。

# this file added ~/.bashrc
# fork from http://qiita.com/takayuki206/items/f4d0dbb45e5ee2ee698e
function __show_exit_code() {
  local status=$(echo ${PIPESTATUS[@]})
  local SETCOLOR_FAILURE="echo -en \\033[1;31m"
  local SETCOLOR_NORMAL="echo -en \\033[0;39m"

  for s in ${status}
  do
    if [ ${s} -ne 0 ]; then
      ${SETCOLOR_FAILURE}
      echo -e "[\xe2\x9a\xa0\xef\xb8\x8f  -> ${status// /|}]"
      ${SETCOLOR_NORMAL}
    fi
  done
}
PROMPT_COMMAND='__show_exit_code;'${PROMPT_COMMAND//__show_exit_code;/}

以上是关于sh bash命令错误视图。来自:http://qiita.com/takayuki206/items/f4d0dbb45e5ee2ee698e的主要内容,如果未能解决你的问题,请参考以下文章

sh 来自http://ss64.com/bash/ls.html

sh Bash If语句示例 - 来自http://www.thegeekstuff.com/2010/06/bash-if-statement-examples

sh Bash - 时间戳功能示例 - 来自http://stackoverflow.com/questions/17066250/create-timestamp-variable-in-bash

sh Bash - 时间戳功能示例 - 来自http://stackoverflow.com/questions/17066250/create-timestamp-variable-in-bash

sh 如果超过超时,则在bash中杀死命令来自https://stackoverflow.com/questions/687948/timeout-a-command-in-bash-without-

sh Bash - 样本If-Then - 来自http://tldp.org/LDP/abs/html/nestedifthen.html