Last active
December 20, 2015 15:19
-
-
Save kcrt/6153253 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
# | |
# .zshrc | |
# Written by kcrt <http://profile.kcrt.net> | |
# Nanoseconds Hunter "http://www.kcrt.net" | |
# | |
# 参考: | |
# http://nijino.homelinux.net/diary/200206.shtml#200206140 | |
# http://d.hatena.ne.jp/umezo/20100508/1273332857 | |
# http://www.clear-code.com/blog/2011/9/5.html | |
source ~/etc/script/OSNotify.sh | |
source ~/etc/script/echo_color.sh | |
source ~/etc/script/miscs.sh | |
local tmpTitle="" | |
# ----- 環境変数のチェック | |
export LANG=ja_JP.UTF-8 | |
# ----- とりあえず | |
stty stop undef # ^Sとかを無効にする。 | |
# ----- ホスト毎にプロンプト色の変更 | |
typeset -A hostcolors | |
typeset -A hostblacks | |
hostcolors=(kcrt.net cyan coxae yellow peletta magenda ulna magenda radius green) | |
hostblacks=(kcrt.net 001111 coxae 001111 peletta 110000 ulna 110000 radius 001100) | |
if [[ "$hostcolors[$HOST]" == "" ]]; then | |
hostcolor=blue | |
hostblack="000000" | |
else | |
hostcolor=$hostcolors[$HOST] | |
hostblack=$hostblacks[$HOST] | |
fi | |
export hostcolor | |
export hostblacks | |
if [[ "$TERM" == "xterm" ]]; then | |
# 色の個別設定 - うまく動かない端末もあります | |
echo -n "]R" # first, reset the palette | |
echo -n "]P0$hostblack" # black | |
echo -n "]P1FF0000" # red | |
echo -n "]P200CC00" # green | |
echo -n "]P3CCCC00" # yellow | |
echo -n "]P45555FF" # blue | |
echo -n "]P5FF00FF" # magenta | |
echo -n "]P600FFFF" # cyan | |
echo -n "]P7CCCCCC" # white | |
echo -n "]P8888888" # BLACK | |
echo -n "]P9FFAAAA" # RED | |
echo -n "]PA88FF88" # GREEN | |
echo -n "]PBFFFFAA" # YELLOW | |
echo -n "]PC7777FF" # BLUE | |
echo -n "]PDFFCCFF" # MAGENTA | |
echo -n "]PE88FFFF" # CYAN | |
echo -n "]PFFFFFFF" # WHITE | |
# タイトルバーの文字列 | |
if [[ "$SSH_CONNECTION" != "" ]]; then | |
# ssh接続 | |
tmpTitle=`echo -n $SSH_CONNECTION | sed -e 's/\(.*\) .* \(.*\) .*/\1 --> \2/g'` | |
echo "]2;$HOST($tmpTitle, ssh)\a" | |
elif [[ "$REMOTEHOST" != "" ]]; then | |
# おそらくtelnet | |
echo -n "]2;$REMOTEHOST --> $HOST\a"; | |
elif [[ "$OSTYPE" == "cygwin" ]]; then | |
# cygwin | |
echo -n "]2;$HOST (cygwin)\a"; | |
else | |
# 普通のローカル | |
echo -n "]2;$HOST (local)\a" | |
fi | |
fi | |
# ----- 環境変数(本当はzshenvに書くべきだけど) | |
export EDITOR="vim" # やっぱりvimだね | |
export COLOR="tty" | |
# ----- パスの設定(これも本当はzshenvに書くべき) | |
# (N-/): 存在しないディレクトリは登録しない。 | |
typeset -U path # 重複したパスを登録しない | |
path=(/bin(N-/) | |
/sbin(N-/) | |
$HOME/local/bin(N-/) | |
/opt/local/bin(N-/) | |
/usr/local/bin(N-/) | |
/usr/bin(N-/) | |
/usr/games(N-/) | |
/usr/texbin(N-/)) | |
typeset -U sudo_path # 重複したパスを登録しない。 | |
typeset -xT SUDO_PATH sudo_path # -x: export も一緒に行う。 -T: 変数を連動させる | |
sudo_path=(/sbin(N-/) | |
/usr/sbin(N-/) | |
/usr/local/sbin(N-/) | |
/usr/pkg/sbin(N-/)) | |
# tex | |
#export TEXDIR=/usr/local/texlive/2012 | |
#export TEXMF=$TEXDIR/texmf | |
#export TEXMFMAIN=$TEXDIR/texmf | |
#export TEXMFSYSCONFIG=$TEXMFMAIN-config | |
#export TEXMFDIST=$TEXMFMAIN-dist | |
#export TEXMFSYSVAR=$TEXMFMAIN-var | |
#export TEXMFLOCAL=/usr/local/texlive/texmf-local | |
#export TEXMFCNF=$TEXDIR | |
# ----- 色関係 | |
autoload colors # $color[red]とかが使えるようになる。 | |
colors | |
if [[ -x dircolors ]]; then | |
eval `dircolors -b` | |
fi | |
export ZLS_COLORS=$LS_COLORS | |
export CLICOLOR=true | |
# ----- autoloadたち | |
autoload -Uz is-at-least # versionによる判定 | |
autoload -U compinit | |
compinit -u | |
autoload zmv | |
autoload zargs | |
autoload zsh/files | |
autoload -Uz url-quote-magic | |
if [[ -f /etc/zsh_command_not_found ]]; then | |
source /etc/zsh_command_not_found | |
fi | |
# 設定はNOを頭につけると逆の意味になるよ! | |
# ----- 補完 | |
LISTMAX=200 # 表示する最大補完リスト数 | |
setopt auto_list # 曖昧な補完で自動的にリスト表示 | |
setopt NO_menu_complete # 一回目の補完で候補を挿入(cf. auto_menu) | |
setopt auto_menu # 二回目の補完で候補を挿入 | |
setopt magic_equal_subst # (?) --include=/usr.. などの=補完を有効に | |
setopt NO_complete_in_word # TODO:よくわからない | |
setopt list_packed # 補完候補をできるだけつめて表示する | |
setopt NO_list_beep # 補完候補表示時にビープ音を鳴らす | |
setopt list_types # ファイル名のおしりに識別マークをつける | |
zstyle ':completion:*' format '%B%d%b' | |
zstyle ':completion:*' group-name '' # 補完候補をグループ化する | |
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # 補完も色つける | |
zstyle ':completion:*' use-cache yes | |
zstyle ':completion:*' verbose yes # 詳細な情報を使う。 | |
zstyle ':completion:sudo:*' environ PATH="$SUDO_PATH:$PATH" ## sudo時にはsudo用のパスも使う。 | |
zstyle ':completion:*:default' menu select=2 | |
zstyle ':completion:*:processes' command 'ps x -o pid,args' # kill <tab>での補完 | |
# ----- 履歴 | |
HISTFILE="$HOME/.zhistory" # 履歴保存先 | |
HISTSIZE=1000 # 使用する履歴数 | |
SAVEHIST=1000 # 保存する履歴数 | |
setopt hist_ignore_space # スペースで始まるコマンドを記録しない | |
setopt hist_ignore_all_dups # 重複した履歴を記録しない | |
setopt share_history # ターミナル間の履歴を共有する | |
setopt append_history # 履歴を追記する | |
# ----- ファイル操作関連 | |
setopt auto_cd # ディレクトリ名でcd | |
setopt auto_remove_slash # 不要なスラッシュをはずす | |
setopt auto_pushd # 自動的にpushd | |
setopt pushd_ignore_dups # 重複したディレクトリスタックを記録しない | |
setopt correct # コマンドのスペル補正 | |
setopt correct_all # コマンド以外もスペル補正 | |
setopt equals # =zshとかが置換される | |
setopt extended_glob # 拡張グロブ有効 | |
# ----- そのほかの設定 | |
setopt prompt_subst # プロンプトでのコマンド置換などを有効に | |
setopt beep # エラー時にはBeep音 | |
setopt notify # バックグラウンドジョブの状態変化を報告 | |
setopt NO_emacs # viが一番! | |
setopt NO_flow_control # ^S/^Qを有効にするかどうか | |
disable r # r (再実行コマンド)を無効にする | |
# ----- Japanese, Wide Char set, and Unicode | |
setopt print_eight_bit # 8ビット文字表示 | |
function unicodetest(){ | |
echo "ASCII: ABCDEFGabcdefg" | |
echo "Japanese: 本日は晴天なり。" | |
echo "Symbol: ○△□●▲■◎+ー×÷※" | |
echo "Symbol: [][][][][][][][][][][][]" | |
echo "Symbol: 〠♫✔✘✂✰" | |
echo "Symbol: 😄😊😃👌👎🇯🇵" | |
} | |
# ----- Version Control(svn, git)のブランチなどを表示 | |
RPROMPT="" | |
if is-at-least 4.3.7; then | |
autoload -Uz vcs_info | |
autoload -Uz add-zsh-hook | |
# formats 平時、actionformats merge conflictなど特殊な状況 | |
# %s -> VCS in use, %b -> branch, %a -> action | |
zstyle ':vcs_info:*' formats '%s: %b%c%u' | |
zstyle ':vcs_info:*' actionformats '%s: %b%c%u[%a]' | |
# git | |
if is-at-least 4.3.10; then | |
zstyle ':vcs_info:git:*' check-for-changes true | |
zstyle ':vcs_info:git:*' stagedstr "+" | |
zstyle ':vcs_info:git:*' unstagedstr "*" | |
fi | |
precmd_vcs_info () { | |
psvar=() | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" | |
} | |
add-zsh-hook precmd precmd_vcs_info | |
RPROMPT="%1(v|%F{green}%1v%f|)" | |
fi | |
# ----- プロンプト | |
PROMPT='%{%(!.$fg[red].$fg[$hostcolor])%}[%n@%m]%# %{$reset_color%}' | |
# 最後に実行したプログラムがエラーだと反転するよ。 | |
RPROMPT="$RPROMPT %{%(?.$fg[cyan].$bg[cyan]$fg[black])%} [%~] %{$reset_color%}" | |
# ----- キー | |
bindkey -v | |
bindkey '^z' push-line | |
bindkey 'OP' run-help # F1 | |
bindkey -r ',' # unbind | |
bindkey -r '/' | |
# viモードではあるが一部のemacsキーバインドを有効にする。 | |
bindkey '' beginning-of-line | |
bindkey '' end-of-line | |
bindkey '' backward-char | |
bindkey '' forward-char | |
bindkey '' up-line-or-history | |
bindkey '' down-line-or-history | |
bindkey '' vi-backward-delete-char | |
# ----- 自分用関数 | |
function ShowStatus(){ | |
# モードの切り替え時に右上にモードを表示 | |
integer Cursor_X | |
integer Cursor_Y | |
integer StrLength | |
StrLength=$(echo -n $1 | wc -m) | |
Cursor_X=$[COLUMNS-$StrLength] # 場所はお好みで | |
Cursor_Y=1 | |
echo -n "[s" # push pos | |
echo -n "[$[$Cursor_Y];$[$Cursor_X]H" # set pos | |
echo -n "[07;37m$1[m" # print | |
echo -n "[u" # pop pos | |
} | |
# viins <-> vicmd {{{ | |
function Vi_ToCmd(){ | |
ShowStatus "-- NORMAL --" | |
builtin zle .vi-cmd-mode | |
} | |
function Vi_Insert(){ | |
ShowStatus "-- INSERT --" | |
builtin zle .vi-insert | |
} | |
function Vi_InsertFirst(){ | |
ShowStatus "-- INSERT --" | |
builtin zle .vi-insert-bol | |
} | |
function Vi_AddNext(){ | |
ShowStatus "-- INSERT --" | |
builtin zle .vi-add-next | |
} | |
function Vi_AddEol(){ | |
ShowStatus "-- INSERT --" | |
builtin zle .vi-add-eol | |
} | |
function Vi_Change(){ | |
ShowStatus "-- INSERT --" | |
builtin zle .vi-change | |
} | |
zle -N Vi_ToCmd | |
zle -N Vi_Insert | |
zle -N Vi_InsertFirst | |
zle -N Vi_AddNext | |
zle -N Vi_AddEol | |
zle -N Vi_Change | |
bindkey -M viins "" Vi_ToCmd | |
bindkey -M vicmd "i" Vi_Insert | |
bindkey -M vicmd "I" Vi_InsertFirst | |
bindkey -M vicmd "a" Vi_AddNext | |
bindkey -M vicmd "A" Vi_AddEol | |
bindkey -M vicmd "c" Vi_Change | |
bindkey -M vicmd "/" history-incremental-pattern-search-backward | |
bindkey '' history-incremental-pattern-search-backward | |
bindkey '' history-incremental-pattern-search-forward | |
bindkey "^Q" self-insert | |
# }}} | |
# ----- 関数 | |
function _w3m(){ | |
W3MOPT= | |
IsScreen=`expr $TERM : screen` | |
if [[ $IsScreen != 0 ]]; then | |
W3MOPT=-no-mouse | |
fi | |
:title w3m $1 | |
if [[ $1 == "" ]]; then | |
\w3m $W3MOPT http://www.google.co.jp | |
else | |
\w3m $W3MOPT $@ | |
fi | |
:title $SHELL | |
} | |
function :svnwhatsnew(){ | |
vimdiff =(svn cat --revision PREV $1) =(svn cat --revision HEAD $1) | |
} | |
fucntion :svnwhatchanged(){ | |
vimdiff $1 =(svn cat --revision HEAD $1) | |
} | |
function trash(){ | |
if [ $# = 0 ]; then | |
command rm | |
return 1 | |
fi | |
if [ ! -d ~/.trash ]; then | |
echo "ERROR : ~/.trash not found!" | |
return 1 | |
fi | |
mv $@ ~/.trash || return | |
if [ $# = 1 ]; then | |
echo "'$1' was moved into trash!" | |
else | |
echo "$# files were moved into trash!" | |
fi | |
} | |
function zipeveryfolder(){ | |
for i in *; do; | |
zip "$i.zip" $i/* | |
done; | |
} | |
function zipeveryfolder_storeonly(){ | |
for i in *; do; | |
zip -0 "$i.zip" $i/* | |
done; | |
} | |
# ----- エイリアス | |
# コマンド置き換え | |
alias vi='vim -p' | |
alias rm='trash' | |
alias w3m=' noglob _w3m' | |
alias exstrings='~/etc/script/exstrings.sh' | |
# 引数 | |
if [[ "$OSTYPE" = darwin* || $OSTYPE = freebs* ]]; then | |
alias ls='ls -FG' | |
alias la='ls -FG -a' | |
alias ll='ls -FG -la -t -r' | |
else | |
alias ls='ls --color=auto' | |
alias la='ls -F -a --color=auto' | |
alias ll='ls -F -la -t -r --color=auto' | |
fi | |
alias du='du -H -s ./*' | |
alias df='df -H' | |
if [ -f /usr/share/vim/vimcurrent/macros/less.sh ]; then | |
alias less=/usr/share/vim/vimcurrent/macros/less.sh | |
elif [ -f /usr/share/vim/vim*/macros/less.sh ]; then | |
alias less='`\ls /usr/share/vim/vim*/macros/less.sh`' | |
else | |
alias less='less --ignore-case --status-column --prompt="?f%f:(stdin).?m(%i/%m files?x, next %x.). ?c<-%c-> .?e(END):%lt-%lb./%Llines" --hilite-unread --tabs=4 --window=-5' | |
fi | |
alias pstree='pstree -p' | |
alias cal='cal -3' | |
alias zmv='noglob zmv' | |
alias zcp='noglob zmv -C' | |
alias zln='noglob zmv -L' | |
alias history='history -E 1' | |
alias wget='noglob wget' | |
alias ping='ping -a -c4' | |
alias sudo='sudo -E ' #スペースを付けておくとsudo llなどが使える | |
alias grep='grep --color=auto --binary-file=without-match --line-number --exclude-dir=.git --exclude-dir=.svn' | |
# 省略とか | |
alias hist='history' | |
alias :q='exit' | |
alias su='su -s =zsh' | |
alias hexdump='od -Ax -tx1z -v' | |
alias beep='print "\a"' | |
alias cls='clear' | |
alias ...='cd ../..' | |
alias ....='cd ../../..' | |
alias .....='cd ../../../..' | |
function vimman(){ | |
vim -c "Man $1" -c "only" | |
} | |
alias man='vimman' | |
alias clang++11='clang++ -O --std=c++11 --stdlib=libc++' | |
alias :svnsetkeyword='svn propset svn:keywords "Id LastChangeDate LastChangeRevision LastChangeBy HeadURL Rev Date Author"' | |
alias :tailf_message='sudo tail -f /var/log/messages' | |
# global alias | |
alias -g N='; OSNotify "shell" "operation finished"' | |
# 思い出し用 | |
alias :howtoglob='echo "**\t複数階層ディレクトリ\n*~tmp\ttmp以外\n[0-9]\t数字\n<0-5>\t0~5までの数字\na(b)#\ta, ab, abb, abbbなどにマッチ\na(b)##\tab, abb, abbbなどにマッチ"' | |
for f in ~/etc/sheet/*; do | |
if [[ `cat $f | wc -l` -ge 7 ]]; then | |
alias :howto${f:t}="less $f" | |
else | |
alias :howto${f:t}="cat $f" | |
fi | |
done | |
# 便利コマンド | |
alias dirsizeinbyte="find . -type f -print -exec wc -c {} \; | awk '{ sum += \$1; }; END { print sum }'" | |
alias finddups="find * -type f -exec shasum \{\} \; | sort | tee /tmp/shasumlist | cut -d' ' -f 1 | uniq -d > /tmp/duplist; while read DUPID; do grep \$DUPID /tmp/shasumlist; done < /tmp/duplist" | |
# ----- suffix alias (関連づけ) | |
alias -s exe='wine' | |
alias -s txt='less' | |
alias -s log='tail -f -n20' | |
alias -s html='w3m' | |
function viewxls(){ | |
w3m -T text/html =(xlhtml $1) | |
} | |
alias -s xls='viewxls' | |
# ----- コマンドライン引数 | |
#export GREP_OPTIONS='--color=auto --binary-file=without-match --line-number --exclude-dir=.git --exclude-dir=.svn' | |
# ----- root以外用の設定 | |
if [[ $USER != 'root' ]] ; then | |
alias updatedb="sudo updatedb; beep" | |
alias taillog='sudo tail -f -n20 /var/log/syslog' | |
fi | |
# ----- Abstraction (予定) | |
if [[ -x /usr/bin/yum ]] ; then | |
alias :package_update="sudo yum update" | |
alias :package_install="sudo yum install" | |
alias :package_file="yum provides" | |
elif [[ -x /usr/bin/aptitude ]] ; then | |
alias :package_update="sudo aptitude update; sudo aptitude safe-upgrade" | |
alias :package_install="sudo aptitude install" | |
alias :package_list="" | |
alias :package_search="sudo aptitude show" | |
alias :package_file="apt-file search" | |
elif [[ -x /usr/local/bin/brew ]] ; then | |
function :package_update(){ | |
brew update | |
brew doctor || return | |
OSNotify 'brew' "`brew outdated`" | |
brew upgrade | |
} | |
elif [[ -x /opt/local/bin/port ]] ; then | |
function :package_update(){ | |
sudo port selfupdate | |
OSNotify 'port' "`sudo port outdated`" | |
sudo nice port upgrade -u outdated | |
if [[ $? == 0 ]]; then | |
OSNotify 'port' 'port upgrade successfully finished.' | |
else | |
OSError 'port' 'port upgrade failed...' | |
fi | |
} | |
alias :package_install="sudo port install" | |
fi | |
# ----- Fedora 固有設定 | |
# alias :suspend="sudo /usr/sbin/pm-suspend" | |
# alias :hibernate="sudo /usr/sbin/pm-hibernate" | |
# ----- cygwin 固有設定 | |
if [[ $OSTYPE = *cygwin* ]] ; then | |
alias updatedb="updatedb --prunepaths='/cygdrive /proc'" | |
alias open='cmd /c start ' | |
alias start='explorer . &' | |
fi | |
# ----- MacOS 固有設定 | |
if [[ $OSTYPE = *darwin* ]] ; then | |
#export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/local/bin:$PATH | |
export MANPATH=/opt/local/man:$MANPATH | |
alias locate='mdfind -name' | |
alias :sleep="pmset sleepnow" | |
fi | |
# ----- screen 使うことにしたよ | |
function :title(){ | |
# 1 : 普通の起動 | |
# 2 : screen上 -> TERM = "screen" | |
# 3 : ssh または screen上でのssh -> SSH_CLIENTが空でない | |
# 4 : ssh上でのscreen -> SSH_CLIENTが空でない かつ STYが空でない | |
tmpTitle=$1 | |
if [[ $USER == "root" ]]; then | |
# rootの場合**を付ける | |
tmpTitle="*$tmpTitle*" | |
fi | |
if [[ "$tmpTitle" == "screen" ]]; then | |
# screen と表示され続けることを避ける | |
tmpTitle="$HOST" | |
fi | |
if [[ -n $SSH_CLIENT ]]; then | |
if [[ -n $STY ]]; then | |
# 4 : ssh上でのscreen | |
echo -n "k$tmpTitle\\" | |
else | |
# 3 : ssh または screen上でのssh | |
# マシン名を付け加える | |
if [[ $tmpTitle != "$HOST" ]]; then | |
tmpTitle="$HOST:$tmpTitle" | |
fi | |
#echo -n "k$tmpTitle\\" | |
echo -n "]2;$tmpTitle\a" | |
fi | |
elif [[ "$TERM" == "screen" || "$TERM" == "screen-bce" ]]; then | |
# 2 : screen上 -> TERM = "screen" | |
echo -n "k$tmpTitle\\" | |
else | |
# 1 : 普通の起動 | |
echo -n "]2;$tmpTitle" | |
fi | |
} | |
alias :split='screen -X split' | |
alias :only='screen -X only' | |
alias :taillog='screen -t syslog sudo tail -f /var/log/syslog' | |
alias :tailapachelog='screen -t syslog sudo tail -f /var/log/apache2/error.log' | |
alias :top='screen -t top top' | |
alias :displays='screen -X displays' | |
function ShowTitle_preexec(){ | |
# --- show title command | |
local -a cmd | |
cmd=(${(z)2}) | |
case $cmd[1] in | |
fg) | |
if (( $#cmd == 1 )); then | |
tmpTitle=(`builtin jobs -l %+`) | |
else | |
tmpTitle=(`builtin jobs -l $cmd[2]`) | |
fi | |
;; | |
%*) | |
# %1 = fg %1 | |
tmpTitle=(`builtin jobs -l $cmd[1]`) | |
;; | |
ls) | |
tmpTitle=`dirs -p | sed -e"1p" -e"d"` | |
;; | |
cd) | |
tmpTitle=$cmd[2] | |
;; | |
sudo) | |
if [[ "$cmd[2]" == "-E" ]]; then | |
tmpTitle="*$cmd[3]*" | |
else | |
tmpTitle="*$cmd[2]*" | |
fi | |
;; | |
ssh|ftp|telnet) | |
tmpTitle="$cmd[1]:$cmd[2]"; | |
;; | |
*) | |
tmpTitle=$cmd[1]; | |
;; | |
esac | |
:title $tmpTitle | |
} | |
local COMMAND="" | |
local COMMAND_TIME="0" | |
function CheckCommandTime_preexec(){ | |
# --- notify long command | |
COMMAND="$1" | |
COMMAND_TIME=`date +%s` | |
} | |
function CheckCommandTime_precmd(){ | |
# --- notify long command | |
IsError=$? | |
if [[ "$COMMAND_TIME" -ne "0" ]]; then | |
local d=`date +%s` | |
d=`expr $d - $COMMAND_TIME` | |
if [[ "$d" -ge "30" ]] ; then | |
if [[ IsError -ne 0 ]]; then | |
OSError "$COMMAND" "took $d seconds and finally failed." | |
else | |
OSNotify "$COMMAND" "took $d seconds and finally finished." | |
fi | |
fi | |
fi | |
COMMAND="" | |
COMMAND_TIME="0" | |
} | |
add-zsh-hook preexec ShowTitle_preexec | |
add-zsh-hook precmd CheckCommandTime_precmd | |
add-zsh-hook preexec CheckCommandTime_preexec | |
if [[ -x `which screen` ]]; then | |
if [[ `expr $TERM : screen` -eq 0 ]]; then | |
sleep 1 | |
screen -r | |
fi | |
else | |
echo "screen not found." | |
fi | |
# finally, execute fortune. | |
if [[ -x `which fortune` ]]; then | |
echo "" | |
echo -n "[36m" | |
fortune -a | |
echo -n "[0m" | |
echo "" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment