filesize.sh 278 B

12345678910111213141516
  1. #!/bin/sh
  2. check_command() {
  3. which "$1" >/dev/null 2>&1
  4. }
  5. if check_command gnustat; then
  6. gnustat -c%s "$@"
  7. elif check_command gstat; then
  8. gstat -c%s "$@"
  9. elif check_command stat; then
  10. stat -c%s "$@"
  11. else
  12. echo "$0: no suitable stat implementation was found" >&2
  13. exit 1
  14. fi