aboutsummaryrefslogtreecommitdiffstats
path: root/bash_include
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-06-17 15:34:02 +0800
committerLAN-TW <lantw44@gmail.com>2012-06-17 15:34:02 +0800
commit9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a (patch)
tree9fd6f34a48f76053c11a09a118c95119377c45b4 /bash_include
parent58c60b12a7fac13673185de87083b2e23393e96f (diff)
downloadconfigfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar.gz
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar.bz2
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar.lz
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar.xz
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.tar.zst
configfile-9ae3ef7be164c291e8b0f95a9e3f08bba7f92c7a.zip
bash_include: 檔案大小判斷支援 sudobash_include-20120617
Diffstat (limited to 'bash_include')
-rw-r--r--bash_include13
1 files 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`