aboutsummaryrefslogtreecommitdiffstats
path: root/bash_include
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2011-12-09 00:21:49 +0800
committerLAN-TW <lantw44@gmail.com>2011-12-09 00:21:49 +0800
commitfe957d2cf883d389ef73d92c09e5c824eae0a5d4 (patch)
treefa205b4ec63f96dfeb74148530d885ea11b5b497 /bash_include
parent6c7742bb0f989abf9c3e2c510def14a22ae442b5 (diff)
downloadconfigfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar.gz
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar.bz2
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar.lz
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar.xz
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.tar.zst
configfile-fe957d2cf883d389ef73d92c09e5c824eae0a5d4.zip
bash_include: 啟動時檢查設定檔案是否存在bash_include-20111209
Diffstat (limited to 'bash_include')
-rw-r--r--bash_include32
1 files changed, 11 insertions, 21 deletions
diff --git a/bash_include b/bash_include
index bed6512..bcb4d87 100644
--- a/bash_include
+++ b/bash_include
@@ -68,8 +68,6 @@ function compile_all ()
[ "$1" = '' ] && echo "Which file(s) do you want to compile? " && return 1
[ "$1" = "-n" ] && noask=1
if [ "$noask" = "0" ]; then
-# read -p "CFLAGS [$CFLAGS] ? " NEWCFLAGS
-# read -p "LDFLAGS [$LDFLAGS] ? " NEWLDFLAGS
read -e -p "CFLAGS: " -i "$CFLAGS" NEWCFLAGS
read -e -p "LDFLAGS: " -i "$LDFLAGS" NEWLDFLAGS
[ "$NEWCFLAGS" '!=' '' ] && CFLAGS=$NEWCFLAGS
@@ -420,27 +418,15 @@ function help_function ()
mkscreenacl username ...
check_dmesg seconds
prehistory_backup
+ check_important_files
ENDHELPMSG
} && return 0
local current_charset=`echo "$LC_ALL" | cut -d . -f 2`
-####local helpmsg_bgrun[0]='bgrun command [arguments ...]'
-####local helpmsg_bgrun[1]='執行指令 command 並將輸出導入檔案'
-####local helpmsg_bgrun[2]='註:此函式會自動以目前時間和指令名稱為檔案命名'
-####local helpmsg_bglist[0]='bglist [--full]'
-####local helpmsg_bglist[1]='列出所有使用 bgrun 執行的指令'
-####local helpmsg_bglist[2]='若加上 --full 選項,則可同時察看時間'
-####local helpmsg_view[0]='bgview [number]'
-####local helpmsg_view[1]='顯示以 bgrun 執行指令的輸出,若省略 number,表示是最近一次執行的指令'
-####local helpmsg_view[2]='若 number > 0,表示第 number 個指令 (此數值可由 bglist 函式取得)'
-####local helpmsg_view[3]='若 number <= 0,表示第「指令總數-number」個指令 (指令總數可由 bgcount 函式取得)'
local -i i
while [ "$1" ]
do
case "$1" in
"bgrun")
-# echo "Run a command in background and redirect its output to file."
-# echo "Note: The name of the file is automatically generated from current time and command name."
-# i=0; while [ "${helpmsg_bgrun[$i]}" ]; do print_iconv "UTF-8" "$current_charset" "${helpmsg_bgrun[$i]}"; i=$i+1; done
cat << ENDHELPMSG | print_iconv "UTF-8" "$current_charset"
bgrun command [arguments ...]
執行指令 command 並將輸出導入檔案
@@ -448,10 +434,6 @@ bgrun command [arguments ...]
ENDHELPMSG
;;
"bglist")
-# echo "List command started by bgrun."
-# echo " Options:"
-# echo " --full print time as well."
-# i=0; while [ "${helpmsg_bglist[$i]}" ]; do print_iconv "UTF-8" "$current_charset" "${helpmsg_bglist[$i]}"; i=$i+1; done
cat << ENDHELPMSG | print_iconv "UTF-8" "$current_charset"
bglist [--full]
列出所有使用 bgrun 執行的指令
@@ -459,7 +441,6 @@ bglist [--full]
ENDHELPMSG
;;
"bgview")
-# i=0; while [ "${helpmsg_bgview[$i]}" ]; do print_iconv "UTF-8" "$current_charset" "${helpmsg_bgview[$i]}"; i=$i+1; done
cat << ENDHELPMSG | print_iconv "UTF-8" "$current_charset"
bgview [number]
顯示以 bgrun 執行指令的輸出,若省略 number,表示是最近一次執行的指令
@@ -537,8 +518,18 @@ function split_arguments ()
done
}
+function check_important_files ()
+{
+ IMPORTANT_FILES='.screenrc .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"
+ done
+}
+
# Doing something
+check_important_files
startcolor
prehistory_backup
@@ -564,4 +555,3 @@ shopt -s mailwarn
echo "Done"
-# check_dmesg.sh 5 &