From 0edc77e9862fc76c62bdc557655282783efa434b Mon Sep 17 00:00:00 2001 From: LAN-TW Date: Fri, 6 Apr 2012 22:48:03 +0800 Subject: =?UTF-8?q?bash=5Finclude:=20mvfile=20=E5=8F=AF=E7=95=A5=E9=81=8E?= =?UTF-8?q?=E6=AA=94=E6=A1=88=E5=AD=98=E5=9C=A8=E6=AA=A2=E6=9F=A5=E3=80=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20wc=20-l=20=E4=BB=A3=E6=9B=BF=20wc=20?= =?UTF-8?q?=E5=92=8C=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_include | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bash_include') diff --git a/bash_include b/bash_include index 2e5c4f6..a0f3054 100644 --- a/bash_include +++ b/bash_include @@ -30,6 +30,7 @@ trashdir="$HOME/trash" HISTSIZE=1000000 HISTFILESIZE=1000000 HISTCONTROL=ignoredups:ignorespace +HISTTIMEFORMAT="%F %T " REALPATH_PROGRAM="realpath" @@ -321,7 +322,7 @@ function check_dmesg () function prehistory_backup () { echo "Checking your current history file" - local currentcount=`wc "$HISTFILE" | awk '{print $1}'` + local -i currentcount=`cat "$HISTFILE" | wc -l` [ '!' -f "$historycountfile" ] && touch "$historycountfile" local -i previoushistorycount previoushistorycount=`cat "$historycountfile"` @@ -772,13 +773,15 @@ function set_console_title () function mvfile () { + local nocheck=0 + [ "$1" = "-n" ] && nocheck=1 && shift split_arguments "$@" local -i i=0 while [ "${arglist[$i]}" ] do - if [ '!' -e "${arglist[$i]}" ] + if [ "$nocheck" = "0" ] && [ '!' -e "${arglist[$i]}" ] then - printf "\e[33mWarning\e[m: ${arglist[$i]} does not exist.\n" + printf "\e[33mWarning\e[m: ${arglist[$i]} does not exist. (Use -n to override)\n" i=$i+1 continue fi @@ -873,7 +876,7 @@ function help_function () convert_to_html filename ... keep_sudo_credential [seconds] mkscreenacl username ... - mvfile filename ... [-- sudo_prefix] + mvfile [-n] filename ... [-- sudo_prefix] prehistory_backup set_console_title x createdir_askmode dirname -- cgit v1.2.3