Created
March 31, 2013 07:38
-
-
Save shigemk2/5279897 to your computer and use it in GitHub Desktop.
ディレクトリを除く、ディレクトリ内のファイルサイズの平均を取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script shows file-size average | |
ls -lF | grep -v / | awk ' | |
{ sum += $5 } END { ave = 0; ave = sum / (NR-1) / 1024; if(ave < 1024) { printf("%3.2f%s\n", ave, "KB"); } else { ave /= 1024 ; printf("%3.2f%s\n", ave, "MB"); } } | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment