-
-
Save mba811/ea46f0e41e1b635a5fb6 to your computer and use it in GitHub Desktop.
Today Scripts:个性化 Yosemite 通知栏-CPU
This file contains hidden or 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
| ps xro %cpu=,comm= | while read cpu comm; ((i++<5)); do | |
| int=$cpu | |
| int="${int%%.*}" | |
| if (($int >= 50)); then color=$'\e[31m'; | |
| elif (($int >= 25)); then color=$'\e[33m'; | |
| else color=$'\e[32m'; | |
| fi; | |
| echo "$color$cpu% $(basename "$comm")"$'\e[0m'""; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment