Skip to content

Instantly share code, notes, and snippets.

@fumiyas
Created May 2, 2012 12:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fumiyas/2576253 to your computer and use it in GitHub Desktop.
Save fumiyas/2576253 to your computer and use it in GitHub Desktop.
端末ウィンドウタイトルと右プロンプトに這いよる混沌 (zsh, bash)
#!/bin/zsh
#!/bin/bash
##
## 端末ウィンドウタイトルと右プロンプトに這いよる混沌 (zsh)
## 端末ウィンドウタイトルに這いよる混沌 (bash)
## Written by SATOH Fumiyasu
## https://github.com/fumiyas
## https://twitter.com/#!/satoh_fumiyasu
##
## Inspired by:
## http://www.kaoriya.net/blog/2012/04/18
## http://www.manabii.info/2012/05/bash-wn.html
chaos=0
chaos() {
let chaos="$chaos % 7"
case "$chaos" in
1|3|5)
echo -n '(」・ω・)」うー!'
;;
2|4|6)
echo -n '(/・ω・)/にゃー!'
;;
0)
echo -n "Let's\(・ω・)/にゃー!"
;;
esac
}
chaos_r=0
chaos_r() {
let chaos_r="$chaos_r % 7"
case "$chaos_r" in
1|3|5)
echo -n 'うー!⎿(・ω・⎿)'
#echo -n 'うー!∠(・ω・∠)'
#echo -n 'うー!└(・ω・└)'
;;
2|4|6)
echo -n 'にゃー!\(・ω・\)'
;;
0)
echo -n "Let's\(・ω・)/にゃー!"
;;
esac
}
if [ -n "$PS1" ]; then
case "${SHELL-}${BASH-}" in
*/zsh)
precmd() {
let chaos++
let chaos_r++
echo -n "\e]0;"; chaos; echo -n "\a";
RPROMPT=$(chaos_r)
}
;;
*/bash)
chaos_succ() {
let chaos++
}
PROMPT_COMMAND=chaos_succ
PS1="$PS1\e]0;\$(chaos)\a"
;;
esac
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment