# 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;/}