Created
December 7, 2011 10:46
-
-
Save dekokun/1442360 to your computer and use it in GitHub Desktop.
直前のコマンドの成功失敗をみて色を変えながら成功失敗を出力するシェルスクリプトの関数
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
check() | |
{ | |
local result=$? | |
local red=$'\e[0;31m' | |
local green=$'\e[0;32m' | |
local default=$'\e[m' | |
if [ $result -eq 0 ] | |
then | |
echo -n $green | |
echo $1 OK | |
echo -n $default | |
else | |
echo -n $red | |
echo $1 Fail | |
echo -n $default | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment