aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2011-12-22 23:59:03 +0800
committerLAN-TW <lantw44@gmail.com>2011-12-22 23:59:03 +0800
commit29cf6e8f784c74514602ed619b2169801723c9cc (patch)
tree185ef1116d9c186584b2fec9380191e2e3602482
parent3da86c05abb69d5ec8c01a613b75ea129e0c4402 (diff)
downloadconfigfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar.gz
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar.bz2
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar.lz
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar.xz
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.tar.zst
configfile-29cf6e8f784c74514602ed619b2169801723c9cc.zip
bash_include: 變更部份檔案路徑與顯示訊息bash_include-20111222
-rw-r--r--bash_include20
1 files changed, 12 insertions, 8 deletions
diff --git a/bash_include b/bash_include
index 95fb227..8e7e10d 100644
--- a/bash_include
+++ b/bash_include
@@ -290,14 +290,14 @@ function check_dmesg ()
function prehistory_backup ()
{
- echo "Backing up current history file"
+ echo "Checking current history file"
local currentcount=`wc "$HISTFILE" | awk '{print $1}'`
[ '!' -f "$historycountfile" ] && touch "$historycountfile"
local -i previoushistorycount
previoushistorycount=`cat "$historycountfile"`
if [ "$currentcount" -lt "$previoushistorycount" ]
then
- printf "\e[1;31mWarning\e[m: Your $HISTFILE may be MODIFIED BY OTHER PROGRAMS!\n"
+ printf "\e[1;31mWarning\e[m: Your $HISTFILE may be MODIFIED OR TRUNCATED BY OTHER PROGRAMS!\n"
printf "Note: \e[1;33m$currentcount\e[m < $previoushistorycount\n"
echo "Your $historycountfile and $historybackupfile will not be overwritten until this problem is fixed."
echo " 1. Check your $HISTFILE."
@@ -307,6 +307,7 @@ function prehistory_backup ()
echo " 4. Run the command \`prehistory_backup' again."
return 3
fi
+ echo "Backing up current history file ($previoushistorycount -> $currentcount)"
echo "$currentcount" > "$historycountfile"
\cp -f "$HISTFILE" "$historybackupfile"
}
@@ -546,7 +547,7 @@ function split_arguments ()
function check_important_files ()
{
- IMPORTANT_FILES='.screenrc .vimrc'
+ IMPORTANT_FILES="$HOME/.screenrc $HOME/.vimrc"
for i in $IMPORTANT_FILES
do
[ '!' -f "$i" ] && printf "\e[1;31mWarning\e[m: \e[1;33m$i\e[m does not exist.\n"
@@ -557,7 +558,7 @@ function check_important_files ()
function split_path ()
{
- local fifoname="$HOME/`uuidgen`"
+ local fifoname="$HOME/tmp/`uuidgen`"
mkfifo "$fifoname"
local -i i=0
local oneline
@@ -570,7 +571,6 @@ function split_path ()
done
exec 3<&-
unlink "$fifoname"
- echo $oneline
}
function update_path ()
@@ -831,6 +831,8 @@ function keep_sudo_credential ()
# Doing something
+umask 0022
+
if [ "$interactive_shell" ]
then
echo "Running interactive shell configuration"
@@ -841,9 +843,11 @@ then
bind '"\e[B":history-search-forward'
fi
-[ "`uname`" = "Linux" ] && REALPATH_PROGRAM="readlink -f"
-
-umask 0022
+if [ "`uname`" = "Linux" ]
+then
+ [ "$interactive_shell" ] && echo "Setting special things for Linux"
+ REALPATH_PROGRAM="readlink -f"
+fi
[ "$interactive_shell" ] && echo "Setting shell options"