nsbin/lls
Nico Schottelius d3c6e29902 Initial commit
2006-07-20 09:54:37 +02:00

25 lines
449 B
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
tmp=/tmp/.lls.$$
ls -l $* | tee $tmp
sum=0
anz=0
for i in $(cut $tmp -b 33-41); do
i=${i##*[^0-9,´ ´]*}
if [ i ]; then
sum=$[$sum+$i]
anz=$[$anz+1]
fi
done
echo -n "$anz Dateien, "
if [ $sum -ge 1000000 ]; then
echo -n $[$sum/1000000]
printf "%.3d," $[($sum % 1000000)/1000]
printf "%.3d" $[$sum % 1000]
elif [ $sum -ge 1000 ]; then
echo -n $[$sum/1000]
printf "%.3d" $[$sum % 1000]
else
echo -n $sum
fi
echo " Bytes"
rm $tmp