aboutsummaryrefslogtreecommitdiffstats
path: root/bash_include
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-06-16 14:53:33 +0800
committerLAN-TW <lantw44@gmail.com>2012-06-16 14:53:33 +0800
commit58c60b12a7fac13673185de87083b2e23393e96f (patch)
tree82aca77df4a8e416d1aa4a51f8cc764f1759fe6c /bash_include
parentb09782b9c64ac10800c84a697f9afbf000b428bc (diff)
downloadconfigfile-58c60b12a7fac13673185de87083b2e23393e96f.tar
configfile-58c60b12a7fac13673185de87083b2e23393e96f.tar.gz
configfile-58c60b12a7fac13673185de87083b2e23393e96f.tar.bz2
configfile-58c60b12a7fac13673185de87083b2e23393e96f.tar.lz
configfile-58c60b12a7fac13673185de87083b2e23393e96f.tar.xz
configfile-58c60b12a7fac13673185de87083b2e23393e96f.tar.zst
configfile-58c60b12a7fac13673185de87083b2e23393e96f.zip
bash_include: 改進顯示目錄容量的功能bash_include-20120616
Diffstat (limited to 'bash_include')
-rw-r--r--bash_include38
1 files changed, 34 insertions, 4 deletions
diff --git a/bash_include b/bash_include
index 572f671..a6e63c3 100644
--- a/bash_include
+++ b/bash_include
@@ -107,7 +107,7 @@ function compile_all ()
printf "$1: Unknown suffix (\e[1;33mskipped\e[0m)\n"
fi
[ "$?" '!=' "0" ] && printf\
- '\e[1;31mError\e[0m while compiling file\n'
+ '\e[1;31mError\e[0m while compiling file\n'
shift
done
return 0
@@ -147,6 +147,15 @@ function mkscreenacl ()
done
}
+function get_directory_size ()
+{
+ du -s "$1" | {
+ read -d " " dirsize
+ echo "$dirsize"
+ read throwaway
+ }
+}
+
########## Background ##########
alias bgr=bgrun
@@ -299,7 +308,23 @@ function bgclean ()
function bgdu ()
{
- du -a "$bgrunfiledir"
+ local -i j=1
+ {
+ echo " INDEX SIZE PID COMMAND"
+ for i in `find "$bgrunfiledir" -maxdepth 1 -mindepth 1 | sort`
+ do
+ head -n 1 "$i" | {
+ local procpid
+ local cmdline
+ read -d ' ' procpid
+ read cmdline
+ printf "%6d %8d (%5d) %s\n" "$j" \
+ "`get_directory_size "$i"`" \
+ "$procpid" "$cmdline"
+ }
+ j=$j+1
+ done
+ } | $PAGER
}
########## Background End ##########
@@ -506,12 +531,16 @@ function trash_du ()
{
split_arguments "$@"
local oneline
+ local -i i=1
find "$trashdir" -maxdepth 1 -mindepth 1 | sort | {
while read oneline
do
- echo "'$oneline'"
+ printf "%6d %8d %s\n" "$i" \
+ "`get_directory_size "$oneline"`" \
+ "`cat "$oneline/information.path"`"
+ i=$i+1
done
- } | xargs -n 10 "${prefixlist[@]}" du -s
+ } | $PAGER
unset arglist
unset prefixlist
}
@@ -912,6 +941,7 @@ function help_function ()
set_console_title
x createdir_askmode dirname
x split_arguments [arguments ...]
+ x get_directory_size dirname
ENDHELPMSG
} && return 0
local current_charset=`echo "$LC_ALL" | cut -d . -f 2`