Last active
January 29, 2017 10:23
-
-
Save bootjp/92488227c7d69beeffae0b2bf720a297 to your computer and use it in GitHub Desktop.
bash command error view. fork from : http://qiita.com/takayuki206/items/f4d0dbb45e5ee2ee698e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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;/} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment