bin/mydu: sort by size
1 files changed, 7 insertions(+), 5 deletions(-)

M bin/mydu
M bin/mydu +7 -5
@@ 3,11 3,13 @@ 
 # Print human-readable disk size of given files/directories
 
 if test -z "$*"; then
-    # No args were passed
-    du -sh $(hidden)  # sizes of hidden files
-    du -sh *  # sizes of files and dirs
-    du -sh .  # total size of current dir
+    # No args were passed, show sizes of current dir and its contents
+    {
+        du -sh $(hidden)  # sizes of hidden files
+        du -sh *  # sizes of files and dirs
+    } | sort -h  # sort both
+    du -sh .  # End with total size of current dir
 else
     # Sizes of given files
-    du -sh "$@"
+    du -sh "$@" | sort -h
 fi