From 9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a Mon Sep 17 00:00:00 2001 From: LAN-TW Date: Sun, 17 Jun 2012 15:34:02 +0800 Subject: =?UTF-8?q?bash=5Finclude:=20=E6=AA=94=E6=A1=88=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=88=A4=E6=96=B7=E6=94=AF=E6=8F=B4=20sudo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_include | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bash_include b/bash_include index a6e63c3..b353480 100644 --- a/bash_include +++ b/bash_include @@ -147,13 +147,16 @@ function mkscreenacl () done } -function get_directory_size () +function get_file_size () { - du -s "$1" | { + split_arguments "$@" + "${prefixlist[@]}" du -s "${arglist[@]}" | { read -d " " dirsize echo "$dirsize" read throwaway } + unset arglist + unset prefixlist } ########## Background ########## @@ -319,7 +322,7 @@ function bgdu () read -d ' ' procpid read cmdline printf "%6d %8d (%5d) %s\n" "$j" \ - "`get_directory_size "$i"`" \ + "`get_file_size "$i"`" \ "$procpid" "$cmdline" } j=$j+1 @@ -536,7 +539,7 @@ function trash_du () while read oneline do printf "%6d %8d %s\n" "$i" \ - "`get_directory_size "$oneline"`" \ + "`get_file_size "$oneline" -- "${prefixlist[@]}"`" \ "`cat "$oneline/information.path"`" i=$i+1 done @@ -941,7 +944,7 @@ function help_function () set_console_title x createdir_askmode dirname x split_arguments [arguments ...] - x get_directory_size dirname + x get_file_size filename [-- sudo_prefix] ENDHELPMSG } && return 0 local current_charset=`echo "$LC_ALL" | cut -d . -f 2` -- cgit v1.2.3