From beb600507a976e29445ecee1fe3e54bfcb100816 Mon Sep 17 00:00:00 2001 From: LAN-TW Date: Sat, 25 Aug 2012 14:56:40 +0800 Subject: bash_include: 加入透過 .bash_addps 強調正在使用的主機位置 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_addps_ntucsie | 2 ++ bash_addps_tfcis | 2 ++ bash_include | 28 ++++++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 bash_addps_ntucsie create mode 100644 bash_addps_tfcis diff --git a/bash_addps_ntucsie b/bash_addps_ntucsie new file mode 100644 index 0000000..8d0bae6 --- /dev/null +++ b/bash_addps_ntucsie @@ -0,0 +1,2 @@ +\[\e[1;41m\]NTUCSIE\[\e[m\] +NTUSCIE diff --git a/bash_addps_tfcis b/bash_addps_tfcis new file mode 100644 index 0000000..3c3d0bd --- /dev/null +++ b/bash_addps_tfcis @@ -0,0 +1,2 @@ +\[\e[45m\]TFCIS\[\e[m\] +TFCIS diff --git a/bash_include b/bash_include index b353480..1cac71a 100644 --- a/bash_include +++ b/bash_include @@ -4,6 +4,10 @@ # # -- UTF-8 -- # +# 設定用外部檔案: +# (1) 若 .bash_title 存在且未設定自動修改視窗標題,則依照本檔案內定規則修改 +# (2) 若 .bash_addps 存在,則第一行的的內容會加到 colorprompting 變數,第二 +# 行的內容會加到 nocolorprompting 變數 #### if tty -s; then interactive_shell=1; fi if [[ "$-" == *i* ]] ; then interactive_shell=1; fi @@ -13,8 +17,8 @@ if [[ "$-" == *i* ]] ; then interactive_shell=1; fi # Internal Variables -colorprompting='\[\e[1;31m\]\!\[\e[m\] [\[\e[1;33m\]\u\[\e[m\]@\[\e[1;32m\]\h\[\e[m\] \[\e[1;36m\]\w\[\e[m\]]\$ ' -nocolorprompting='\! [\u@\h \w]\$ ' +colorprompting='\[\e[1;31m\]\!\[\e[m\] [\[\e[1;33m\]\u\[\e[m\]@\[\e[1;32m\]\h\[\e[m\] \[\e[1;36m\]\w\[\e[m\]]' +nocolorprompting='\! [\u@\h \w]' if [ "$SSH_CONNECTION" ] then @@ -22,6 +26,26 @@ then nocolorprompting="*$nocolorprompting" fi +if [ -f "$HOME/.bash_addps" ] +then + exec 3< "$HOME/.bash_addps" + read -u 3 -r oneline + colorprompting="$oneline $colorprompting" + read -u 3 -r oneline + nocolorprompting="$oneline $nocolorprompting" + exec 3<&- + unset oneline +fi + +if [ "$WINDOW" ] +then + colorprompting="$colorprompting<$WINDOW>" + nocolorprompting="$nocolorprompting<$WINDOW>" +fi + +colorprompting="${colorprompting}\$ " +nocolorprompting="${nocolorprompting}\$ " + historycountfile="$HOME/.bash_history.count" historybackupfile="$HOME/.bash_history.bak" bgrunfiledir="$HOME/tmp/bgrun-`whoami`" -- cgit