3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

コマンド実行結果がエラーであることを確認しやすくする

Posted at

smiley.gif

こんな感じでコマンドの終了ステータスが非ゼロの時にだけ泣いて教えてくれます。

以下は上の GIF の設定です。

smiley() {
    local err=$?
    if [[ ${err} -ne 0 ]]; then
        echo -e "\e[5;31m(T.T) ${err}\e[m "
    fi
}
PROMPT='`smiley`'"%F{yellow}%~
%K{cyan}MBP%k%F{cyan} >%f "

Zsh 用なので Bash でも使うためには PROMPT の色を書き換える必要があると思います。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?