source:
BOOK/filesize.sh@
3dd740ba
| Last change on this file since 3dd740ba was 78a84e5, checked in by , 17 years ago | |
|---|---|
|
|
| File size: 408 bytes | |
| Rev | Line | |
|---|---|---|
| [cc73be6] | 1 | #!/bin/bash |
| 2 | ||
| 3 | FILENAME=$1 | |
| 4 | ||
| 5 | if [ "${FILENAME}" = "" ]; then | |
| 6 | echo "To Calculate the proper file size use the following command." | |
| 7 | echo "$0 filename" | |
| 8 | exit 255 | |
| 9 | else | |
| [78a84e5] | 10 | FILESIZE=$(ls -l ${FILENAME} | cut -f5 -d' ') |
| [cc73be6] | 11 | ((size=${FILESIZE}/1024)) |
| [78a84e5] | 12 | if [ "${size}" = "0" ]; then |
| 13 | size=$(echo .$(echo ${FILESIZE} | cut -b1)) | |
| 14 | fi | |
| [cc73be6] | 15 | FILEMD5SUM=$(md5sum ${FILENAME}) |
| 16 | ||
| 17 | echo "${size} KB" | |
| 18 | echo "${FILEMD5SUM}" | |
| 19 | fi |
Note:
See TracBrowser
for help on using the repository browser.
