diff options
author | LAN-TW <lantw44@gmail.com> | 2011-12-17 00:09:36 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2011-12-17 00:09:36 +0800 |
commit | 50fb4d08f5ac6c50699687bc6e17ed30c6c9261e (patch) | |
tree | e3979ae18953254db5f9a8bc6de2f4b841a69663 /bash_include | |
parent | e2a8abca2c7ffd29e347ba4a5ea478d765a58e08 (diff) | |
download | configfile-50fb4d08f5ac6c50699687bc6e17ed30c6c9261e.tar.gz configfile-50fb4d08f5ac6c50699687bc6e17ed30c6c9261e.tar.zst configfile-50fb4d08f5ac6c50699687bc6e17ed30c6c9261e.zip |
bash_include: 加入判斷是否在終端機執行的全域變數bash_include-20111217
Diffstat (limited to 'bash_include')
-rw-r--r-- | bash_include | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/bash_include b/bash_include index 7e9aaad..b3f1e1b 100644 --- a/bash_include +++ b/bash_include @@ -5,7 +5,9 @@ # -- UTF-8 -- # -echo "Running .bash_include" +if tty -s; then interactive_shell=1; fi + +[ "$interactive_shell" ] && echo "Running .bash_include" # Internal Variables @@ -636,24 +638,21 @@ function path_editor () # Doing something -check_important_files -startcolor -prehistory_backup - -[ "`uname`" = "Linux" ] && REALPATH_PROGRAM="readlink -f" - -umask 0022 - -echo "Setting key binding" - -tty -s -if [ "$?" = "0" ] +if [ "$interactive_shell" ] then + echo "Running interactive shell configuration" + check_important_files + startcolor + prehistory_backup bind '"\e[A":history-search-backward' bind '"\e[B":history-search-forward' fi -echo "Setting shell options" +[ "`uname`" = "Linux" ] && REALPATH_PROGRAM="readlink -f" + +umask 0022 + +[ "$interactive_shell" ] && echo "Setting shell options" shopt -s histappend shopt -s checkwinsize @@ -662,5 +661,5 @@ shopt -s checkhash shopt -s cmdhist shopt -s mailwarn -echo "Done" +[ "$interactive_shell" ] && echo "Done" |