aboutsummaryrefslogtreecommitdiffstats
path: root/bash_include
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-04-06 22:48:03 +0800
committerLAN-TW <lantw44@gmail.com>2012-04-06 22:48:03 +0800
commit0edc77e9862fc76c62bdc557655282783efa434b (patch)
tree42f97c4b915a01c15844e3d5df97026a508c002f /bash_include
parent75c9326039822a85be528f300c4622fed2000e21 (diff)
downloadconfigfile-0edc77e9862fc76c62bdc557655282783efa434b.tar
configfile-0edc77e9862fc76c62bdc557655282783efa434b.tar.gz
configfile-0edc77e9862fc76c62bdc557655282783efa434b.tar.bz2
configfile-0edc77e9862fc76c62bdc557655282783efa434b.tar.lz
configfile-0edc77e9862fc76c62bdc557655282783efa434b.tar.xz
configfile-0edc77e9862fc76c62bdc557655282783efa434b.tar.zst
configfile-0edc77e9862fc76c62bdc557655282783efa434b.zip
bash_include: mvfile 可略過檔案存在檢查、使用 wc -l 代替 wc 和 awkbash_include-20120406
Diffstat (limited to 'bash_include')
-rw-r--r--bash_include11
1 files changed, 7 insertions, 4 deletions
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