home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1754 < prev    next >
Internet Message Format  |  1990-12-28  |  3KB

  1. From: jeff@quark.WV.TEK.COM (Jeff Beadles)
  2. Newsgroups: alt.sources
  3. Subject: adf - Another disk free program for SYSV
  4. Message-ID: <8461@orca.wv.tek.com>
  5. Date: 30 Aug 90 17:39:46 GMT
  6.  
  7.  
  8. [ Note - This does not have an archive header, as it's a beta release]
  9.  
  10. This is a wrapper for df, that will give you all sorts of cutesy information.
  11.  
  12. The documentation is in the comments at the start of the script.
  13.  
  14. If you have any comments, suggestions, or other useful information, please drop
  15. me a note.
  16.  
  17.     -Jeff
  18. -- 
  19. Jeff Beadles                jeff@quark.WV.TEK.COM 
  20. Utek Engineering, Tektronix Inc.    +1 503 685 2568
  21.             SPEEA - Just say no.
  22.  
  23.  
  24. #--------------------------------CUT HERE-------------------------------------
  25. #! /bin/sh
  26. #
  27. # This is a shell archive.  Save this into a file, edit it
  28. # and delete all lines above this comment.  Then give this
  29. # file to sh by executing the command "sh file".  The files
  30. # will be extracted into the current directory owned by
  31. # you with default permissions.
  32. #
  33. # The files contained herein are:
  34. #
  35. # -rwxr-xr-x  1 jeff         1436 Aug 30 10:23 adf
  36. #
  37. echo 'x - adf'
  38. if test -f adf; then echo 'shar: not overwriting adf'; else
  39. sed 's/^X//' << '________This_Is_The_END________' > adf
  40. X#!/bin/sh
  41. X##
  42. X## Another df, for Sysv.  Works with local or remote filesystems.  Version 2.0
  43. X##
  44. X## Tossed together and released to the public domain by Jeff Beadles,
  45. X##                            jeff@nitwit.wv.tek.com
  46. X##
  47. X## I'm not responsible if this turns your system into a pile of molten silicon,
  48. X## or anything else. :-)
  49. X##
  50. X## The 'sed' line removes the '(' and '):' from around the remote filesystem
  51. X## name.  By default it looks like   "(nitwit:/usr3   ):", and joins the
  52. X## two lines together. (free space and total space.).  The awk script does the
  53. X## math, and "pretty printing".
  54. X##
  55. X##
  56. X## This expects df -t output to look like:
  57. X##
  58. X## /        (/dev/dsk/c-0d00s0 ):    91468 blocks   109921 i-nodes
  59. X##                    total:   467558 blocks  118400 i-nodes
  60. X##
  61. X## And will give output like:
  62. X##
  63. X## Filesystem                             MB Used  MB free   MB total   % full
  64. X## /                                          188       45        233      80%
  65. X##
  66. X## Options:  (Same as df, except the '-t' flag is always on.)
  67. X##
  68. X## Some of the more useful options are:
  69. X##    '-l' = local disk information only.
  70. X##    'dir' = Free space on dir.  (ie adf /usr2)
  71. X##
  72. X
  73. Xdf -t $* | sed -e 's/[)(:]//g' -e '/$/N' -e 's/\n/ /' |
  74. X    awk ' BEGIN {
  75. X    printf "%-40s  MB Used  MB free   MB total   %% full\n", "Filesystem" }
  76. X        { printf "%-40s     % 4d     % 4d      % 5d     %3d%%\n", \
  77. X    $1, ($8 - $3) / 2000, $3 / 2000, $8 / 2000, 100 - ($3 / $8 * 100)
  78. X    }'
  79. Xexit 0
  80. ________This_Is_The_END________
  81. if test `wc -c < adf` -ne 1436; then
  82.     echo 'shar: adf was damaged during transit (should have been 1436 bytes)'
  83. fi
  84. fi        ; : end of overwriting check
  85. exit 0
  86.