Created
June 19, 2013 07:42
-
-
Save metalefty/5812350 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
# bashrc の中で実行するコマンドが $? を上書きする前に参照するために最初の方に書く | |
# colored prompt | |
RETURN_CODE='\[$(if [ $? -eq 0 ]; then echo -en \e[32m ; else echo -en \e[31m; fi; echo -en █\e[m;)\]' | |
# | |
# 途中に git-completion や bash-completion によるプロンプトの変更をお好みで挟んで | |
# | |
# 最後に終了ステータスによって切り替えたものをくっつける | |
PS1="${RETURN_CODE}${PS1}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment