diff options
author | LAN-TW <lantw44@gmail.com> | 2012-01-01 18:57:11 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2012-01-01 18:57:11 +0800 |
commit | a8d38a00b0c0144556f067b47708764bf6cb3ee2 (patch) | |
tree | 54c2775a1a544d18628c9597fdc88f3f19b2887b | |
parent | 6670854e82fad60ca52a023ec41353d5138e4754 (diff) | |
download | configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar.gz configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar.bz2 configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar.lz configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar.xz configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.tar.zst configfile-a8d38a00b0c0144556f067b47708764bf6cb3ee2.zip |
bash_include: 改善部份錯誤訊息以及操作方式bash_include-20120101
-rw-r--r-- | bash_include | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bash_include b/bash_include index c5fdbd5..b146d35 100644 --- a/bash_include +++ b/bash_include @@ -8,11 +8,10 @@ if tty -s; then interactive_shell=1; fi [ "$interactive_shell" ] && echo "Running .bash_include" +[ "$interactive_shell" ] && default_tty_setting=`stty -g` # Internal Variables -[ "$interactive_shell" ] && default_tty_setting=`stty -g` - 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]\$ ' @@ -27,7 +26,7 @@ HISTCONTROL=ignoredups:ignorespace REALPATH_PROGRAM="realpath" - +CFLAGS="-Wall -pipe -g" # Environment Variables @@ -87,7 +86,7 @@ function compile_all () true else printf\ - '\e[1;33mWarning\e[0m: Non-existent file or not a regular file\n' + "\e[1;33mWarning\e[0m: $1 Non-existent file or not a regular file\n" shift ; continue fi [ "$TARGETFILE" = "$1" ] && shift && continue @@ -98,7 +97,7 @@ function compile_all () echo "[CXX] $1 -> $TARGETFILE" g++ $CFLAGS "$1" $LDFLAGS -o "$TARGETFILE" else - printf 'Unknown suffix (\e[1;33mskipped\e[0m)\n' + printf "$1: Unknown suffix (\e[1;33mskipped\e[0m)\n" fi [ "$?" '!=' "0" ] && printf\ '\e[1;31mError\e[0m while compiling file\n' @@ -646,10 +645,11 @@ function path_editor_core () echo "$i: ${patharr[$i]}" i=$i+1 done + [ "$i" = '0' ] && echo "(Empty or not declared)" echo "========================================" - read -e -p "(A)ppend/(D)elete/(E)dit/(M)ove/(R)eset/(Q)uit ? " command + read -e -p "[A]ppend/(D)elete/(E)dit/(M)ove/(R)eset/(Q)uit ? " command case "$command" in - A|a) + ''|A|a) read -e -p "Type new entry: " patharr[$i] update_path ;; @@ -739,7 +739,7 @@ function backup_file () printf "\e[1;33mPlease delete some backup file because I only use 0 - 9.\e[m\n" fi else - "${prefixlist[@]}" \cp "${arglist[$i]}" "$rootfilename" + "${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename" fi i=$i+1 done |