LoginSignup
15
14

More than 5 years have passed since last update.

zshのプロンプトに定時を教えてもらう

Posted at

定時退社

定時になったらダッシュで帰りたい!!!!!
気づくと定時すぎてるなんてことは嫌だ!!!!
そうだ、定時になったらプロンプトに定時って表示しよう!!!!
スクリーンショット 2014-05-07 23.31.57.png

表示させる

.zshrcとかに適当にこんなん書く

PROMPT='%{${fg[cyan]}%}%n@%{${fg[green]}%}%~ %{${fg[yellow]}%}$(if [ $(date +"%k") -gt 19 ] ; then echo "定時だ帰るぞ!!!!"; fi) %{${fg[cyan]}%}    \$ %{${reset_color}%}'

重要なのはここだけ

%{${fg[yellow]}%}$(if [ $(date +"%k") -gt 18 ] ; then echo "定時だ帰るぞ!!!!"; fi)

dateコマンドで時間見て、現在時刻が18以上だったら表示する(この例では19時が定時)

こんな感じになる
スクリーンショット 2014-05-07 23.36.31.png

さいごに

もっといい感じにするのありそう

15
14
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
15
14