aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-01-04 00:17:43 +0800
committerLAN-TW <lantw44@gmail.com>2012-01-04 00:17:43 +0800
commitfe0d42f3ef3376f1af3c30499e57ace338134bf3 (patch)
treed17468b36705ce7aaa67afdabf6743541ab1a6f5
parenta8d38a00b0c0144556f067b47708764bf6cb3ee2 (diff)
downloadconfigfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar.gz
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar.bz2
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar.lz
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar.xz
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.tar.zst
configfile-fe0d42f3ef3376f1af3c30499e57ace338134bf3.zip
bash_include: 改善部份說明訊息、備份檔案時保留時間戳bash_include-20120103
-rw-r--r--bash_include8
1 files changed, 5 insertions, 3 deletions
diff --git a/bash_include b/bash_include
index b146d35..8561a65 100644
--- a/bash_include
+++ b/bash_include
@@ -289,7 +289,7 @@ function check_dmesg ()
do
PREVIOS_DMESG_BUF="$DMESG_BUF"
DMESG_BUF="`dmesg`"
- [ "$PREVIOS_DMESG_BUF" '!=' "$DMESG_BUF" ] && [ "$FIRST_RUN" = "4" ] && echo '===> system message buffer was modified <==='
+ [ "$PREVIOS_DMESG_BUF" '!=' "$DMESG_BUF" ] && [ "$FIRST_RUN" = "0" ] && echo '===> You should check the system message buffer <==='
sleep $1
[ "$?" '!=' "0" ] && return 1
FIRST_RUN=0
@@ -305,7 +305,7 @@ function prehistory_backup ()
previoushistorycount=`cat "$historycountfile"`
if [ "$currentcount" -lt "$previoushistorycount" ]
then
- printf "\e[1;31mWarning\e[m: Your $HISTFILE may be MODIFIED OR TRUNCATED BY OTHER PROGRAMS!\n"
+ printf "\e[1;31mWarning\e[m: Your $HISTFILE may be TRUNCATED OR OVERWRITTEN 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."
@@ -729,7 +729,8 @@ function backup_file ()
j=$j+1
continue
else
- "${prefixlist[@]}" \cp "${arglist[$i]}" "$rootfilename.$j"
+ "${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename.$j"
+ "${prefixlist[@]}" touch -r "${arglist[$i]}" "$rootfilename.$j"
break
fi
done
@@ -740,6 +741,7 @@ function backup_file ()
fi
else
"${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename"
+ "${prefixlist[@]}" touch -r "${arglist[$i]}" "$rootfilename"
fi
i=$i+1
done