From: Florian Baumann Date: Tue, 2 Nov 2010 13:50:45 +0000 (+0100) Subject: usage() for os x and linux X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=e45e72ec2705445476ee37725ded19eace970857;p=common%2Fbash_it.git usage() for os x and linux --- diff --git a/plugins/base.plugin.bash b/plugins/base.plugin.bash index 2d78028..d19b149 100644 --- a/plugins/base.plugin.bash +++ b/plugins/base.plugin.bash @@ -32,12 +32,21 @@ pri() { # disk usage per directory +# in Mac OS X and Linux usage () { - if [ $1 ] - then - du -hd $1 - else - du -hd 1 - fi + if [ $(uname) = "Darwin" ]; then + if [ -n $1 ]; then + du -hd $1 + else + du -hd 1 + fi + + elif [ $(uname) = "Linux" ]; then + if [ -n $1 ]; then + du -h --max-depth=1 $1 + else + du -h --max-depth=1 + fi + fi }