-
-
Save yurriy/f61dd6d9f54da7bdec1cd5861b0d18d4 to your computer and use it in GitHub Desktop.
du alternative
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/bash | |
my_du () { | |
ans=0 | |
for file in $(find $1) | |
do | |
if [ -f $file ] | |
then | |
sz=$(wc -c $file | { read first rest; echo $first; }) | |
ans=$(expr $ans + $sz) | |
fi | |
done | |
echo $ans | |
return 0; | |
} | |
my_du $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment